Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔥hot-fix: debug logs remove; #1069

Merged
merged 1 commit into from
Feb 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/lib/utils/debug.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// import { dev } from '$app/environment';
import { dev } from '$app/environment';

export const PAGE_INVALID_MSG = `Uh-oh! This page does not exist!`;
export const ERROR_CODE_INVALID = 404;
Expand All @@ -13,8 +13,8 @@ const MASTER_DEBUG_TOGGLE = undefined

// NOTE: overrides "dev" state and forces logs even in PROD where dev == false;
// NOTE: (values) true/false | dev
// NOTE: For PROD should always be FALSE
const DEV_OVERRIDE = true
// NOTE:IMPORTANT For PROD should always be FALSE on PR -> (main)
const LOGS_SHOW_OVERRIDE = dev

// NOTE: naming of new DEBUG variables is of following structure:
// NOTE: [2]_W/P_TAG/TOG/STY
Expand Down Expand Up @@ -168,8 +168,8 @@ export function dlog(
) {
// [🐞]
show = MASTER_DEBUG_TOGGLE != undefined ? MASTER_DEBUG_TOGGLE : show
if (DEV_OVERRIDE && show && !style) console.debug(msg);
if (DEV_OVERRIDE && typeof(msg) == 'string' && show && style) console.debug(`%c${msg}`, style);
if (LOGS_SHOW_OVERRIDE && show && !style) console.debug(msg);
if (LOGS_SHOW_OVERRIDE && typeof(msg) == 'string' && show && style) console.debug(`%c${msg}`, style);
}

/**
Expand All @@ -189,7 +189,7 @@ export function dlogv2(
style?: string
) {
// [🐞]
if (DEV_OVERRIDE && show) {
if (LOGS_SHOW_OVERRIDE && show) {
console.groupCollapsed(
`%c${groupName}`,
style
Expand Down Expand Up @@ -222,7 +222,7 @@ export function dlogv2open(
style?: string
) {
// [🐞]
if (DEV_OVERRIDE && show) {
if (LOGS_SHOW_OVERRIDE && show) {
console.group(
`%c${groupName}`,
style
Expand All @@ -247,5 +247,5 @@ export function errlog(
msg: string
) {
// [🐞]
if (DEV_OVERRIDE) console.error(`❌ Error: ${msg}`);
if (LOGS_SHOW_OVERRIDE) console.error(`❌ Error: ${msg}`);
}