ng2-logger 21.0.64 → 21.0.66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/VERIFIED-BUILD-DATA.jsonc +3 -3
  2. package/browser/package.json +1 -1
  3. package/browser-prod/package.json +1 -1
  4. package/full-dts/build-info._auto-generated_.d.ts +1 -1
  5. package/lib/build-info._auto-generated_.d.ts +1 -1
  6. package/lib/build-info._auto-generated_.js +1 -1
  7. package/lib/package.json +1 -1
  8. package/lib-esm/lib/build-info._auto-generated_.d.ts +1 -1
  9. package/lib-esm/lib/build-info._auto-generated_.js +1 -1
  10. package/lib-prod/build-info._auto-generated_.d.ts +1 -1
  11. package/lib-prod/build-info._auto-generated_.js +1 -1
  12. package/lib-prod/package.json +1 -1
  13. package/package.json +1 -1
  14. package/ts-source/browser-code/build-info._auto-generated_.ts +13 -0
  15. package/ts-source/browser-code/demo-simple.ts +26 -0
  16. package/ts-source/browser-code/demo.ts +100 -0
  17. package/ts-source/browser-code/index._auto-generated_.ts +7 -0
  18. package/ts-source/browser-code/index.scss +6 -0
  19. package/ts-source/browser-code/index.ts +8 -0
  20. package/ts-source/browser-code/lib-info.md +8 -0
  21. package/ts-source/browser-code/migrations/index.ts +8 -0
  22. package/ts-source/browser-code/migrations/migrations-info.md +6 -0
  23. package/ts-source/browser-code/migrations/migrations_index._auto-generated_.ts +7 -0
  24. package/ts-source/browser-code/ng2-logger.ts +237 -0
  25. package/ts-source/browser-code/start-cli.ts +15 -0
  26. package/ts-source/browser-code-prod/build-info._auto-generated_.split-namespaces.json +4 -0
  27. package/ts-source/browser-code-prod/build-info._auto-generated_.ts +13 -0
  28. package/ts-source/browser-code-prod/demo-simple.split-namespaces.json +4 -0
  29. package/ts-source/browser-code-prod/demo-simple.ts +26 -0
  30. package/ts-source/browser-code-prod/demo.split-namespaces.json +4 -0
  31. package/ts-source/browser-code-prod/demo.ts +100 -0
  32. package/ts-source/browser-code-prod/index._auto-generated_.split-namespaces.json +4 -0
  33. package/ts-source/browser-code-prod/index._auto-generated_.ts +7 -0
  34. package/ts-source/browser-code-prod/index.scss +6 -0
  35. package/ts-source/browser-code-prod/index.split-namespaces.json +4 -0
  36. package/ts-source/browser-code-prod/index.ts +8 -0
  37. package/ts-source/browser-code-prod/lib-info.md +8 -0
  38. package/ts-source/browser-code-prod/migrations/index.split-namespaces.json +4 -0
  39. package/ts-source/browser-code-prod/migrations/index.ts +8 -0
  40. package/ts-source/browser-code-prod/migrations/migrations-info.md +6 -0
  41. package/ts-source/browser-code-prod/migrations/migrations_index._auto-generated_.split-namespaces.json +4 -0
  42. package/ts-source/browser-code-prod/migrations/migrations_index._auto-generated_.ts +7 -0
  43. package/ts-source/browser-code-prod/ng2-logger.split-namespaces.json +24 -0
  44. package/ts-source/browser-code-prod/ng2-logger.ts +235 -0
  45. package/ts-source/browser-code-prod/start-cli.split-namespaces.json +4 -0
  46. package/ts-source/browser-code-prod/start-cli.ts +15 -0
  47. package/ts-source/websql-code/build-info._auto-generated_.ts +13 -0
  48. package/ts-source/websql-code/demo-simple.ts +26 -0
  49. package/ts-source/websql-code/demo.ts +100 -0
  50. package/ts-source/websql-code/index._auto-generated_.ts +7 -0
  51. package/ts-source/websql-code/index.scss +6 -0
  52. package/ts-source/websql-code/index.ts +8 -0
  53. package/ts-source/websql-code/lib-info.md +8 -0
  54. package/ts-source/websql-code/migrations/index.ts +8 -0
  55. package/ts-source/websql-code/migrations/migrations-info.md +6 -0
  56. package/ts-source/websql-code/migrations/migrations_index._auto-generated_.ts +7 -0
  57. package/ts-source/websql-code/ng2-logger.ts +237 -0
  58. package/ts-source/websql-code/start-cli.ts +15 -0
  59. package/ts-source/websql-code-prod/build-info._auto-generated_.split-namespaces.json +4 -0
  60. package/ts-source/websql-code-prod/build-info._auto-generated_.ts +13 -0
  61. package/ts-source/websql-code-prod/demo-simple.split-namespaces.json +4 -0
  62. package/ts-source/websql-code-prod/demo-simple.ts +26 -0
  63. package/ts-source/websql-code-prod/demo.split-namespaces.json +4 -0
  64. package/ts-source/websql-code-prod/demo.ts +100 -0
  65. package/ts-source/websql-code-prod/index._auto-generated_.split-namespaces.json +4 -0
  66. package/ts-source/websql-code-prod/index._auto-generated_.ts +7 -0
  67. package/ts-source/websql-code-prod/index.scss +6 -0
  68. package/ts-source/websql-code-prod/index.split-namespaces.json +4 -0
  69. package/ts-source/websql-code-prod/index.ts +8 -0
  70. package/ts-source/websql-code-prod/lib-info.md +8 -0
  71. package/ts-source/websql-code-prod/migrations/index.split-namespaces.json +4 -0
  72. package/ts-source/websql-code-prod/migrations/index.ts +8 -0
  73. package/ts-source/websql-code-prod/migrations/migrations-info.md +6 -0
  74. package/ts-source/websql-code-prod/migrations/migrations_index._auto-generated_.split-namespaces.json +4 -0
  75. package/ts-source/websql-code-prod/migrations/migrations_index._auto-generated_.ts +7 -0
  76. package/ts-source/websql-code-prod/ng2-logger.split-namespaces.json +24 -0
  77. package/ts-source/websql-code-prod/ng2-logger.ts +235 -0
  78. package/ts-source/websql-code-prod/start-cli.split-namespaces.json +4 -0
  79. package/ts-source/websql-code-prod/start-cli.ts +15 -0
  80. package/websql/package.json +1 -1
  81. package/websql-prod/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  {
2
- "commitHash": "68285ee41ab8acb780a783b9f6f3d436bc7b380c",
3
- "commitName": "release: v21.0.63",
4
- "commitDate": "12-10-2026 02:34:53"
2
+ "commitHash": "2d7d24d1ddbadbec90ccd99ba6fa1fd21d9e2461",
3
+ "commitName": "release: v21.0.65",
4
+ "commitDate": "17-10-2026 02:23:50"
5
5
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ng2-logger/browser",
3
- "version": "21.0.64",
3
+ "version": "21.0.66",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^21.0.0",
6
6
  "@angular/core": "^21.0.0"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ng2-logger/browser-prod",
3
- "version": "21.0.64",
3
+ "version": "21.0.66",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^21.0.0",
6
6
  "@angular/core": "^21.0.0"
@@ -22,4 +22,4 @@ export declare const CURRENT_PACKAGE_TAON_VERSION = "v21";
22
22
  /**
23
23
  * Autogenerated by current cli tool. Use *tnp release* to bump version.
24
24
  */
25
- export declare const CURRENT_PACKAGE_VERSION = "21.0.64";
25
+ export declare const CURRENT_PACKAGE_VERSION = "21.0.66";
@@ -21,4 +21,4 @@ export declare const CURRENT_PACKAGE_TAON_VERSION = "v21";
21
21
  /**
22
22
  * Autogenerated by current cli tool. Use *tnp release* to bump version.
23
23
  */
24
- export declare const CURRENT_PACKAGE_VERSION = "21.0.64";
24
+ export declare const CURRENT_PACKAGE_VERSION = "21.0.66";
@@ -25,6 +25,6 @@ exports.CURRENT_PACKAGE_TAON_VERSION = 'v21';
25
25
  /**
26
26
  * Autogenerated by current cli tool. Use *tnp release* to bump version.
27
27
  */
28
- exports.CURRENT_PACKAGE_VERSION = '21.0.64';
28
+ exports.CURRENT_PACKAGE_VERSION = '21.0.66';
29
29
  // THIS FILE IS GENERATED - DO NOT MODIFY
30
30
  //# sourceMappingURL=build-info._auto-generated_.js.map
package/lib/package.json CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "ng2-logger/lib",
3
- "version": "21.0.64"
3
+ "version": "21.0.66"
4
4
  }
@@ -21,4 +21,4 @@ export declare const CURRENT_PACKAGE_TAON_VERSION = "v21";
21
21
  /**
22
22
  * Autogenerated by current cli tool. Use *tnp release* to bump version.
23
23
  */
24
- export declare const CURRENT_PACKAGE_VERSION = "21.0.64";
24
+ export declare const CURRENT_PACKAGE_VERSION = "21.0.66";
@@ -22,6 +22,6 @@ export const CURRENT_PACKAGE_TAON_VERSION = 'v21';
22
22
  /**
23
23
  * Autogenerated by current cli tool. Use *tnp release* to bump version.
24
24
  */
25
- export const CURRENT_PACKAGE_VERSION = '21.0.64';
25
+ export const CURRENT_PACKAGE_VERSION = '21.0.66';
26
26
  // THIS FILE IS GENERATED - DO NOT MODIFY
27
27
  //# sourceMappingURL=build-info._auto-generated_.js.map
@@ -21,4 +21,4 @@ export declare const CURRENT_PACKAGE_TAON_VERSION = "v21";
21
21
  /**
22
22
  * Autogenerated by current cli tool. Use *tnp release* to bump version.
23
23
  */
24
- export declare const CURRENT_PACKAGE_VERSION = "21.0.64";
24
+ export declare const CURRENT_PACKAGE_VERSION = "21.0.66";
@@ -22,6 +22,6 @@ export const CURRENT_PACKAGE_TAON_VERSION = 'v21';
22
22
  /**
23
23
  * Autogenerated by current cli tool. Use *tnp release* to bump version.
24
24
  */
25
- export const CURRENT_PACKAGE_VERSION = '21.0.64';
25
+ export const CURRENT_PACKAGE_VERSION = '21.0.66';
26
26
  // THIS FILE IS GENERATED - DO NOT MODIFY
27
27
  //# sourceMappingURL=build-info._auto-generated_.js.map
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "ng2-logger/lib-prod",
3
- "version": "21.0.64"
3
+ "version": "21.0.66"
4
4
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ng2-logger",
3
- "version": "21.0.64",
3
+ "version": "21.0.66",
4
4
  "scripts": {
5
5
  "taon init": "taon init",
6
6
  "taon start": "taon start",
@@ -0,0 +1,13 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+ * TAON READONLY SOURCE
4
+ * DO NOT MODIFY THIS FILE.
5
+ * Changes may be overwritten.
6
+ * ========================================================================== */
7
+
8
+ export const BUILD_FRAMEWORK_CLI_NAME = 'tnp';
9
+ export const APP_ID = 'com.domain.example.ng2-logger';
10
+ export const BUILD_BASE_HREF = '';
11
+ export const PROJECT_NPM_NAME = 'ng2-logger';
12
+ export const CURRENT_PACKAGE_TAON_VERSION = 'v21';
13
+ export const CURRENT_PACKAGE_VERSION = '21.0.66';
@@ -0,0 +1,26 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+ * TAON READONLY SOURCE
4
+ * DO NOT MODIFY THIS FILE.
5
+ * Changes may be overwritten.
6
+ * ========================================================================== */
7
+
8
+ import { Helpers } from 'tnp-core/browser';
9
+ import { Log, Level } from './ng2-logger';
10
+ export function demoSimpleTs() {
11
+ Helpers.taskStarted('SIMPLE LOGGER EDGE CASE DEMO');
12
+ const log = Log.create('dashboard');
13
+ const auth = Log.create('auth');
14
+ const demo = Log.create('demo');
15
+ log.info('info');
16
+ demo.i('info alias');
17
+ log.error('error');
18
+ log.er('error alias');
19
+ auth.data('data');
20
+ log.data('PERNAMENT DISABLE');
21
+ auth.moduleWidth = 20;
22
+ auth.d('data alias');
23
+ demo.warn('warn');
24
+ log.w('warn alias');
25
+ Helpers.taskDone('SIMPLE LOGGER EDGE CASE DEMO DONE');
26
+ }
@@ -0,0 +1,100 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+ * TAON READONLY SOURCE
4
+ * DO NOT MODIFY THIS FILE.
5
+ * Changes may be overwritten.
6
+ * ========================================================================== */
7
+
8
+ import { Helpers } from 'tnp-core/browser';
9
+ import { Log, Level } from './ng2-logger';
10
+ export function demoTs() {
11
+ const separator = (title: string) => {
12
+ console.log('\n\n==============================');
13
+ console.log(title);
14
+ console.log('==============================\n');
15
+ };
16
+ Helpers.taskStarted('LOGGER EDGE CASE DEMO');
17
+ separator('1️⃣ BASIC USAGE');
18
+ const log = Log.create('cli');
19
+ log.info('info');
20
+ log.i('info alias');
21
+ log.error('error');
22
+ log.er('error alias');
23
+ log.data('data');
24
+ log.d('data alias');
25
+ log.warn('warn');
26
+ log.w('warn alias');
27
+ separator('2️⃣ GLOBAL LEVEL (WARN+)');
28
+ Log.setGlobalLevel(Level.WARN);
29
+ log.info('SHOULD NOT PRINT');
30
+ log.warn('SHOULD PRINT');
31
+ log.error('SHOULD PRINT');
32
+ Log.setGlobalLevel(null as any);
33
+ separator('3️⃣ ONLY LEVEL (ERROR ONLY)');
34
+ Log.onlyLevel(Level.ERROR);
35
+ log.info('NO');
36
+ log.error('YES');
37
+ Log.onlyLevel();
38
+ separator('4️⃣ DISABLE / ENABLE');
39
+ Log.disableAllLogs();
40
+ log.error('NO PRINT');
41
+ console.log('console.log blocked');
42
+ Log.enableAllLogs();
43
+ log.error('PRINT AGAIN');
44
+ separator('6️⃣ MUTED MODULES');
45
+ Log.settings.mutedModules = ['allowed'];
46
+ const allowed = Log.create('allowed');
47
+ const blocked = Log.create('blocked');
48
+ allowed.info('YES');
49
+ blocked.info('NO');
50
+ Log.settings.mutedModules = [];
51
+ separator('7️⃣ LOGGER.setLevel');
52
+ const levelLog = Log.create('level-test');
53
+ levelLog.setLevel(Level.ERROR);
54
+ levelLog.warn('NO');
55
+ levelLog.error('YES');
56
+ separator('8️⃣ LARGE OBJECT');
57
+ log.info('large object', {
58
+ nested: {
59
+ arr: Array.from({ length: 50 }, (_, i) => i),
60
+ },
61
+ });
62
+ separator('9️⃣ CIRCULAR OBJECT');
63
+ const circular: any = {};
64
+ circular.self = circular;
65
+ log.info('circular test', circular);
66
+ separator('🔟 ERROR OBJECT');
67
+ try {
68
+ throw new Error('boom');
69
+ }
70
+ catch (e) {
71
+ log.error('caught error', e);
72
+ }
73
+ separator('1️⃣1️⃣ SPECIAL VALUES');
74
+ log.info(null as any);
75
+ log.info(undefined as any);
76
+ log.info(NaN as any);
77
+ log.info(Symbol('test') as any);
78
+ log.info(BigInt(123) as any);
79
+ separator('1️⃣2️⃣ VERY LONG MESSAGE');
80
+ log.error('x'.repeat(2000));
81
+ separator('1️⃣3️⃣ TIMESTAMP');
82
+ Log.settings.showTimestamp = true;
83
+ log.info('with timestamp');
84
+ Log.settings.showTimestamp = false;
85
+ separator('1️⃣4️⃣ STRESS TEST (100 logs)');
86
+ for (let i = 0; i < 100; i++) {
87
+ log.info(`spam ${i}`);
88
+ }
89
+ separator('1️⃣5️⃣ MULTIPLE MODULES');
90
+ const a = Log.create('a');
91
+ const b = Log.create('b');
92
+ a.info('module a');
93
+ b.info('module b');
94
+ separator('1️⃣6️⃣ MODULE NAME TRIM');
95
+ const spaced = Log.create('networking ');
96
+ const trimmed = Log.create('networking');
97
+ spaced.info('with trailing space');
98
+ trimmed.info('without trailing space');
99
+ Helpers.taskDone('LOGGER EDGE CASE DEMO DONE');
100
+ }
@@ -0,0 +1,7 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+ * TAON READONLY SOURCE
4
+ * DO NOT MODIFY THIS FILE.
5
+ * Changes may be overwritten.
6
+ * ========================================================================== */
7
+
@@ -0,0 +1,6 @@
1
+ /* ============================================================================
2
+ * TAON READONLY SOURCE
3
+ * DO NOT MODIFY THIS FILE.
4
+ * Changes may be overwritten.
5
+ * ========================================================================== */
6
+
@@ -0,0 +1,8 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+ * TAON READONLY SOURCE
4
+ * DO NOT MODIFY THIS FILE.
5
+ * Changes may be overwritten.
6
+ * ========================================================================== */
7
+
8
+ export * from './ng2-logger';
@@ -0,0 +1,8 @@
1
+ THIS FILE IS GENERATED - DO NOT MODIFY
2
+
3
+ This folder is an entry point for npm Angular/NodeJS library
4
+
5
+ DON'T USE STUFF FROM PARENT FOLDER app.* FILES HERE (except src/migrations/** files).
6
+
7
+ THIS FILE IS GENERATED - DO NOT MODIFY
8
+
@@ -0,0 +1,8 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+ * TAON READONLY SOURCE
4
+ * DO NOT MODIFY THIS FILE.
5
+ * Changes may be overwritten.
6
+ * ========================================================================== */
7
+
8
+ export * from './migrations_index._auto-generated_';
@@ -0,0 +1,6 @@
1
+ THIS FILE IS GENERATED - DO NOT MODIFY
2
+
3
+ This folder is only for storing migration files with auto-generated names.
4
+
5
+ THIS FILE IS GENERATED - DO NOT MODIFY
6
+
@@ -0,0 +1,7 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+ * TAON READONLY SOURCE
4
+ * DO NOT MODIFY THIS FILE.
5
+ * Changes may be overwritten.
6
+ * ========================================================================== */
7
+
@@ -0,0 +1,237 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+ * TAON READONLY SOURCE
4
+ * DO NOT MODIFY THIS FILE.
5
+ * Changes may be overwritten.
6
+ * ========================================================================== */
7
+
8
+ import * as stringify from 'json-stringify-safe';
9
+ import { Helpers, json5, UtilsOs } from 'tnp-core/browser';
10
+ export enum Level {
11
+ DATA,
12
+ INFO,
13
+ WARN,
14
+ ERROR,
15
+ SUCCESS,
16
+ TASK_STARTED,
17
+ TASK_DONE
18
+ }
19
+ export const LevelKey = {
20
+ [Level.DATA]: 'data',
21
+ [Level.INFO]: 'info',
22
+ [Level.WARN]: 'warn',
23
+ [Level.ERROR]: 'error',
24
+ [Level.SUCCESS]: 'success',
25
+ [Level.TASK_STARTED]: 'taskstarted',
26
+ [Level.TASK_DONE]: 'taskdone',
27
+ };
28
+ export const LevelOrder = [
29
+ LevelKey[Level.DATA],
30
+ LevelKey[Level.TASK_STARTED],
31
+ LevelKey[Level.TASK_DONE],
32
+ LevelKey[Level.INFO],
33
+ LevelKey[Level.SUCCESS],
34
+ LevelKey[Level.WARN],
35
+ LevelKey[Level.ERROR],
36
+ ];
37
+ const levelIcon = {
38
+ [Level.INFO]: 'ℹ️',
39
+ [Level.ERROR]: '❌',
40
+ [Level.WARN]: '⚠️',
41
+ [Level.SUCCESS]: '✅',
42
+ [Level.TASK_STARTED]: '🚀',
43
+ [Level.TASK_DONE]: '🏁',
44
+ [Level.DATA]: '',
45
+ };
46
+ export namespace Log {
47
+ const instances = new Map<string, Logger>();
48
+ let originalConsole: Partial<typeof console> | null = null;
49
+ let permanentlyDisabled = false;
50
+ const consoleMethods = ['log', 'info', 'warn', 'error'] as const;
51
+ let globalLevel: Level | null = null;
52
+ export const settings = {
53
+ mutedModules: [] as string[],
54
+ showTimestamp: false,
55
+ };
56
+ const isMutedModule = (moduleName: string): boolean => {
57
+ if (settings.mutedModules.length === 0)
58
+ return false;
59
+ return !Helpers.contain(settings.mutedModules, moduleName);
60
+ };
61
+ export const create = (moduleName: string, ...level: Level[]): Logger => {
62
+ const log = new Logger(moduleName, getRandomColor(), level, isMutedModule(moduleName), undefined);
63
+ instances.set(moduleName, log);
64
+ return log;
65
+ };
66
+ export const setGlobalLevel = (level: Level) => {
67
+ globalLevel = level;
68
+ };
69
+ export const onlyLevel = (...levels: Level[]): void => {
70
+ instances.forEach(instance => {
71
+ instance.allowed = levels;
72
+ });
73
+ };
74
+ export const onlyModules = (...modules: (string | RegExp)[]): void => {
75
+ instances.forEach(instance => {
76
+ const moduleName = instance.moduleName;
77
+ const isAllowed = modules.some(m => {
78
+ if (typeof m === 'string') {
79
+ return m === moduleName;
80
+ }
81
+ if (m instanceof RegExp) {
82
+ return m.test(moduleName);
83
+ }
84
+ return false;
85
+ });
86
+ instance.isMuted = !isAllowed;
87
+ });
88
+ };
89
+ export const disableAllLogsPermanetly = () => {
90
+ if (permanentlyDisabled)
91
+ return;
92
+ if (!originalConsole) {
93
+ originalConsole = {};
94
+ consoleMethods.forEach(m => {
95
+ originalConsole![m] = console[m];
96
+ });
97
+ }
98
+ consoleMethods.forEach(m => {
99
+ console[m] = () => { };
100
+ });
101
+ permanentlyDisabled = true;
102
+ };
103
+ export const disableAllLogs = () => {
104
+ if (permanentlyDisabled)
105
+ return;
106
+ if (!originalConsole) {
107
+ originalConsole = {};
108
+ consoleMethods.forEach(m => {
109
+ originalConsole![m] = console[m];
110
+ });
111
+ }
112
+ consoleMethods.forEach(m => {
113
+ console[m] = () => { };
114
+ });
115
+ };
116
+ export const enableAllLogs = () => {
117
+ if (permanentlyDisabled)
118
+ return;
119
+ if (!originalConsole)
120
+ return;
121
+ consoleMethods.forEach(m => {
122
+ if (originalConsole && originalConsole[m]) {
123
+ console[m] = originalConsole[m] as any;
124
+ }
125
+ });
126
+ };
127
+ class Logger {
128
+ constructor(public readonly moduleName: string, public color: string, public allowed: Level[], public isMuted: boolean, public moduleWidth: number | undefined) {
129
+ this.createLevelMethod(Level.DATA);
130
+ this.createLevelMethod(Level.DATA, 'd');
131
+ this.createLevelMethod(Level.INFO);
132
+ this.createLevelMethod(Level.INFO, 'i');
133
+ this.createLevelMethod(Level.WARN);
134
+ this.createLevelMethod(Level.WARN, 'w');
135
+ this.createLevelMethod(Level.ERROR);
136
+ this.createLevelMethod(Level.ERROR, 'er');
137
+ this.createLevelMethod(Level.SUCCESS);
138
+ this.createLevelMethod(Level.TASK_STARTED);
139
+ this.createLevelMethod(Level.TASK_DONE);
140
+ }
141
+ declare data: (message: string, ...data: any[]) => void;
142
+ declare d: (message: string, ...data: any[]) => void;
143
+ declare info: (message: string, ...data: any[]) => void;
144
+ declare i: (message: string, ...data: any[]) => void;
145
+ declare warn: (message: string, ...data: any[]) => void;
146
+ declare w: (message: string, ...data: any[]) => void;
147
+ declare error: (message: string, ...data: any[]) => void;
148
+ declare er: (message: string, ...data: any[]) => void;
149
+ public setLevel(l: Level) {
150
+ this.allowed = [l];
151
+ return this;
152
+ }
153
+ public mute() {
154
+ this.isMuted = true;
155
+ return this;
156
+ }
157
+ public logOnlyWhen(expression: (() => boolean) | boolean): void {
158
+ this.isMuted =
159
+ typeof expression === 'function' ? !expression() : !expression;
160
+ }
161
+ private createLevelMethod(level: Level, overrideMethodName?: string) {
162
+ const methodName = overrideMethodName
163
+ ? overrideMethodName
164
+ : LevelKey[level];
165
+ (this as any)[methodName] = (message: string, ...data: any[]) => {
166
+ if (this.isMuted)
167
+ return this;
168
+ if (globalLevel !== null && level < globalLevel) {
169
+ return this;
170
+ }
171
+ if (this.allowed.length === 0 || Helpers.contain(this.allowed, level)) {
172
+ displayMsg(message, data.length === 0 ? undefined : data, this.moduleName, this.color, level, this.moduleWidth, permanentlyDisabled);
173
+ }
174
+ return this;
175
+ };
176
+ }
177
+ }
178
+ }
179
+ const getRandomColor = (): string => {
180
+ const letters = '0123456789ABCDEF';
181
+ return ('#' +
182
+ Array.from({ length: 6 })
183
+ .map(() => letters[Math.floor(Math.random() * 16)])
184
+ .join(''));
185
+ };
186
+ const consoleLog = (data: string, level: Level): void => {
187
+ };
188
+ const displayMsg = (message: string, params: any[] | undefined, moduleName: string, moduleColor: string, level: Level, moduleWidth: number | undefined, permanentlyDisabled: boolean): void => {
189
+ if (permanentlyDisabled)
190
+ return;
191
+ if (message) {
192
+ message = `${levelIcon[level]} ${message?.toString()}`;
193
+ }
194
+ else {
195
+ message = levelIcon[level];
196
+ }
197
+ const timestamp = Log.settings.showTimestamp
198
+ ? `[${new Date().toISOString()}] `
199
+ : '';
200
+ if (moduleWidth) {
201
+ const diff = moduleWidth - moduleName.length;
202
+ if (diff > 0) {
203
+ for (let i = 0; i < diff; i++) {
204
+ moduleName += ' ';
205
+ }
206
+ }
207
+ }
208
+ if (UtilsOs.isBrowser) {
209
+ let levelColor = 'gray';
210
+ switch (level) {
211
+ case Level.INFO:
212
+ levelColor = 'deepskyblue';
213
+ break;
214
+ case Level.WARN:
215
+ levelColor = 'orange';
216
+ break;
217
+ case Level.ERROR:
218
+ levelColor = 'red';
219
+ break;
220
+ case Level.SUCCESS:
221
+ levelColor = 'green';
222
+ break;
223
+ case Level.TASK_STARTED:
224
+ levelColor = 'purple';
225
+ break;
226
+ case Level.TASK_DONE:
227
+ levelColor = 'mediumseagreen';
228
+ break;
229
+ case Level.DATA:
230
+ default:
231
+ levelColor = 'gray';
232
+ }
233
+ const moduleStyle = `background:${moduleColor};color:white;padding:2px 4px;border-radius:2px;`;
234
+ const messageStyle = `color:${levelColor};font-weight:${level === Level.ERROR ? 'bold' : 'normal'};`;
235
+ console.log(`%c ${moduleName} %c ${timestamp}${message}`, moduleStyle, messageStyle, ...(params ?? []));
236
+ }
237
+ };
@@ -0,0 +1,15 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+ * TAON READONLY SOURCE
4
+ * DO NOT MODIFY THIS FILE.
5
+ * Changes may be overwritten.
6
+ * ========================================================================== */
7
+
8
+ import { Helpers } from 'tnp-core/browser';
9
+ import { demoTs } from './demo';
10
+ import { demoSimpleTs } from './demo-simple';
11
+ import { Log } from './ng2-logger';
12
+ export async function startCli(argsv: string[], filename: string): Promise<void> {
13
+ return (void 0);
14
+ }
15
+ export default startCli;
@@ -0,0 +1,4 @@
1
+ {
2
+ "namespacesMapObj": {},
3
+ "namespacesReplace": {}
4
+ }
@@ -0,0 +1,13 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+ * TAON READONLY SOURCE
4
+ * DO NOT MODIFY THIS FILE.
5
+ * Changes may be overwritten.
6
+ * ========================================================================== */
7
+
8
+ export const BUILD_FRAMEWORK_CLI_NAME = 'tnp';
9
+ export const APP_ID = 'com.domain.example.ng2-logger';
10
+ export const BUILD_BASE_HREF = '';
11
+ export const PROJECT_NPM_NAME = 'ng2-logger';
12
+ export const CURRENT_PACKAGE_TAON_VERSION = 'v21';
13
+ export const CURRENT_PACKAGE_VERSION = '21.0.66';
@@ -0,0 +1,4 @@
1
+ {
2
+ "namespacesMapObj": {},
3
+ "namespacesReplace": {}
4
+ }
@@ -0,0 +1,26 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+ * TAON READONLY SOURCE
4
+ * DO NOT MODIFY THIS FILE.
5
+ * Changes may be overwritten.
6
+ * ========================================================================== */
7
+
8
+ import { Helpers__NS___fixCommand, Helpers__NS__ActionInstance, Helpers__NS__actionStarted, Helpers__NS__bigMaxBuffer, Helpers__NS__checkProcess, Helpers__NS__cleanExit, Helpers__NS__clearConsole, Helpers__NS__command, Helpers__NS__commandOutputAsString, Helpers__NS__commandOutputAsStringAsync, Helpers__NS__contain, Helpers__NS__createFolder, Helpers__NS__createSymLink, Helpers__NS__error, Helpers__NS__execute, Helpers__NS__exists, Helpers__NS__filesFrom, Helpers__NS__foldersFrom, Helpers__NS__getFilesFrom, Helpers__NS__getFoldersFrom, Helpers__NS__getIsBrowser, Helpers__NS__getIsElectron, Helpers__NS__getIsNode, Helpers__NS__getIsRunningInGitBash, Helpers__NS__getIsSupportedTaonTerminal, Helpers__NS__getIsVerboseMode, Helpers__NS__getIsVerboseModeOrTnp, Helpers__NS__getIsWebSQL, Helpers__NS__getIsWsl, Helpers__NS__getStdio, Helpers__NS__hideNodeWarnings, Helpers__NS__info, Helpers__NS__isBlob, Helpers__NS__isBuffer, Helpers__NS__isClass, Helpers__NS__isExistedSymlink, Helpers__NS__isFile, Helpers__NS__isFolder, Helpers__NS__isRunningInDocker, Helpers__NS__isRunningInLinuxGraphicsCapableEnvironment, Helpers__NS__isSymlinkFileExitedOrUnexisted, Helpers__NS__isSymlinkThatMatchesUrl, Helpers__NS__isUnexistedLink, Helpers__NS__killOnPort, Helpers__NS__killProcess, Helpers__NS__killProcessByPort, Helpers__NS__linksToFolderFrom, Helpers__NS__linksToFoldersFrom, Helpers__NS__log, Helpers__NS__logError, Helpers__NS__logInfo, Helpers__NS__logProc, Helpers__NS__logSuccess, Helpers__NS__logTaskDone, Helpers__NS__logTaskStarted, Helpers__NS__logWarn, Helpers__NS__mediaTypeFromSrc, Helpers__NS__mkdirp, Helpers__NS__modifyLineByLine, Helpers__NS__msgCacheClear, Helpers__NS__openFolderInFileExplorer, Helpers__NS__parse, Helpers__NS__pathContainLink, Helpers__NS__questionYesNo, Helpers__NS__readFile, Helpers__NS__readJson, Helpers__NS__readJson5, Helpers__NS__readJsonC, Helpers__NS__relative, Helpers__NS__remove, Helpers__NS__removeEmptyLineFromString, Helpers__NS__removeFileIfExists, Helpers__NS__removeFolderIfExists, Helpers__NS__removeIfExists, Helpers__NS__removeSlashAtBegin, Helpers__NS__removeSlashAtEnd, Helpers__NS__removeSymlinks, Helpers__NS__renderError, Helpers__NS__replaceLinesInFile, Helpers__NS__run, Helpers__NS__runAsyncIn, Helpers__NS__runSyncIn, Helpers__NS__runSyncOrAsync, Helpers__NS__sleep, Helpers__NS__stopApplication, Helpers__NS__stringify, Helpers__NS__success, Helpers__NS__taskDone, Helpers__NS__taskStarted, Helpers__NS__throwError, Helpers__NS__timeout, Helpers__NS__tryCatchError, Helpers__NS__tryReadFile, Helpers__NS__tryRemoveDir, Helpers__NS__values, Helpers__NS__wait, Helpers__NS__warn, Helpers__NS__writeFile, Helpers__NS__writeJson, Helpers__NS__writeJson5, Helpers__NS__writeJsonC } from 'tnp-core/browser-prod';
9
+ import { Level, Log__NS__create, Log__NS__disableAllLogs, Log__NS__disableAllLogsPermanetly, Log__NS__enableAllLogs, Log__NS__onlyLevel, Log__NS__onlyModules, Log__NS__setGlobalLevel, Log__NS__settings } from './ng2-logger';
10
+ export function demoSimpleTs() {
11
+ Helpers__NS__taskStarted('SIMPLE LOGGER EDGE CASE DEMO');
12
+ const log = Log__NS__create('dashboard');
13
+ const auth = Log__NS__create('auth');
14
+ const demo = Log__NS__create('demo');
15
+ log.info('info');
16
+ demo.i('info alias');
17
+ log.error('error');
18
+ log.er('error alias');
19
+ auth.data('data');
20
+ log.data('PERNAMENT DISABLE');
21
+ auth.moduleWidth = 20;
22
+ auth.d('data alias');
23
+ demo.warn('warn');
24
+ log.w('warn alias');
25
+ Helpers__NS__taskDone('SIMPLE LOGGER EDGE CASE DEMO DONE');
26
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "namespacesMapObj": {},
3
+ "namespacesReplace": {}
4
+ }