mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-15 13:46:16 -08:00
chore: tighten validation and runtime logging
* chore: tighten validation and runtime logging * fix(i18n): localize new settings labels
This commit is contained in:
1 parent
d24c77a143
commit
2d5c4fa4f9
52 files changed
+767
-214
No files matched your search
@@ -0,0 +1,22 @@
|
||||
export type DevLogFn = (...args: unknown[]) => void;
|
||||
|
||||
function isDevLoggingEnabled(): boolean {
|
||||
const global = globalThis as typeof globalThis & {
|
||||
ngDevMode?: boolean;
|
||||
process?: { env?: { NODE_ENV?: string } };
|
||||
};
|
||||
|
||||
return (
|
||||
global.ngDevMode !== false && global.process?.env?.NODE_ENV !== 'test'
|
||||
);
|
||||
}
|
||||
|
||||
export function createDevLogger(scope: string): DevLogFn {
|
||||
const prefix = `[${scope}]`;
|
||||
|
||||
return (...args: unknown[]) => {
|
||||
if (isDevLoggingEnabled()) {
|
||||
console.debug(prefix, ...args);
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user