@firebase/logger 0.4.3 → 0.4.4

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.
package/dist/index.cjs.js CHANGED
@@ -2,221 +2,221 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- /**
6
- * @license
7
- * Copyright 2017 Google LLC
8
- *
9
- * Licensed under the Apache License, Version 2.0 (the "License");
10
- * you may not use this file except in compliance with the License.
11
- * You may obtain a copy of the License at
12
- *
13
- * http://www.apache.org/licenses/LICENSE-2.0
14
- *
15
- * Unless required by applicable law or agreed to in writing, software
16
- * distributed under the License is distributed on an "AS IS" BASIS,
17
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
- * See the License for the specific language governing permissions and
19
- * limitations under the License.
20
- */
21
- /**
22
- * A container for all of the Logger instances
23
- */
24
- const instances = [];
25
- /**
26
- * The JS SDK supports 5 log levels and also allows a user the ability to
27
- * silence the logs altogether.
28
- *
29
- * The order is a follows:
30
- * DEBUG < VERBOSE < INFO < WARN < ERROR
31
- *
32
- * All of the log types above the current log level will be captured (i.e. if
33
- * you set the log level to `INFO`, errors will still be logged, but `DEBUG` and
34
- * `VERBOSE` logs will not)
35
- */
36
- exports.LogLevel = void 0;
37
- (function (LogLevel) {
38
- LogLevel[LogLevel["DEBUG"] = 0] = "DEBUG";
39
- LogLevel[LogLevel["VERBOSE"] = 1] = "VERBOSE";
40
- LogLevel[LogLevel["INFO"] = 2] = "INFO";
41
- LogLevel[LogLevel["WARN"] = 3] = "WARN";
42
- LogLevel[LogLevel["ERROR"] = 4] = "ERROR";
43
- LogLevel[LogLevel["SILENT"] = 5] = "SILENT";
44
- })(exports.LogLevel || (exports.LogLevel = {}));
45
- const levelStringToEnum = {
46
- 'debug': exports.LogLevel.DEBUG,
47
- 'verbose': exports.LogLevel.VERBOSE,
48
- 'info': exports.LogLevel.INFO,
49
- 'warn': exports.LogLevel.WARN,
50
- 'error': exports.LogLevel.ERROR,
51
- 'silent': exports.LogLevel.SILENT
52
- };
53
- /**
54
- * The default log level
55
- */
56
- const defaultLogLevel = exports.LogLevel.INFO;
57
- /**
58
- * By default, `console.debug` is not displayed in the developer console (in
59
- * chrome). To avoid forcing users to have to opt-in to these logs twice
60
- * (i.e. once for firebase, and once in the console), we are sending `DEBUG`
61
- * logs to the `console.log` function.
62
- */
63
- const ConsoleMethod = {
64
- [exports.LogLevel.DEBUG]: 'log',
65
- [exports.LogLevel.VERBOSE]: 'log',
66
- [exports.LogLevel.INFO]: 'info',
67
- [exports.LogLevel.WARN]: 'warn',
68
- [exports.LogLevel.ERROR]: 'error'
69
- };
70
- /**
71
- * The default log handler will forward DEBUG, VERBOSE, INFO, WARN, and ERROR
72
- * messages on to their corresponding console counterparts (if the log method
73
- * is supported by the current log level)
74
- */
75
- const defaultLogHandler = (instance, logType, ...args) => {
76
- if (logType < instance.logLevel) {
77
- return;
78
- }
79
- const now = new Date().toISOString();
80
- const method = ConsoleMethod[logType];
81
- if (method) {
82
- console[method](`[${now}] ${instance.name}:`, ...args);
83
- }
84
- else {
85
- throw new Error(`Attempted to log a message with an invalid logType (value: ${logType})`);
86
- }
87
- };
88
- class Logger {
89
- /**
90
- * Gives you an instance of a Logger to capture messages according to
91
- * Firebase's logging scheme.
92
- *
93
- * @param name The name that the logs will be associated with
94
- */
95
- constructor(name) {
96
- this.name = name;
97
- /**
98
- * The log level of the given Logger instance.
99
- */
100
- this._logLevel = defaultLogLevel;
101
- /**
102
- * The main (internal) log handler for the Logger instance.
103
- * Can be set to a new function in internal package code but not by user.
104
- */
105
- this._logHandler = defaultLogHandler;
106
- /**
107
- * The optional, additional, user-defined log handler for the Logger instance.
108
- */
109
- this._userLogHandler = null;
110
- /**
111
- * Capture the current instance for later use
112
- */
113
- instances.push(this);
114
- }
115
- get logLevel() {
116
- return this._logLevel;
117
- }
118
- set logLevel(val) {
119
- if (!(val in exports.LogLevel)) {
120
- throw new TypeError(`Invalid value "${val}" assigned to \`logLevel\``);
121
- }
122
- this._logLevel = val;
123
- }
124
- // Workaround for setter/getter having to be the same type.
125
- setLogLevel(val) {
126
- this._logLevel = typeof val === 'string' ? levelStringToEnum[val] : val;
127
- }
128
- get logHandler() {
129
- return this._logHandler;
130
- }
131
- set logHandler(val) {
132
- if (typeof val !== 'function') {
133
- throw new TypeError('Value assigned to `logHandler` must be a function');
134
- }
135
- this._logHandler = val;
136
- }
137
- get userLogHandler() {
138
- return this._userLogHandler;
139
- }
140
- set userLogHandler(val) {
141
- this._userLogHandler = val;
142
- }
143
- /**
144
- * The functions below are all based on the `console` interface
145
- */
146
- debug(...args) {
147
- this._userLogHandler && this._userLogHandler(this, exports.LogLevel.DEBUG, ...args);
148
- this._logHandler(this, exports.LogLevel.DEBUG, ...args);
149
- }
150
- log(...args) {
151
- this._userLogHandler &&
152
- this._userLogHandler(this, exports.LogLevel.VERBOSE, ...args);
153
- this._logHandler(this, exports.LogLevel.VERBOSE, ...args);
154
- }
155
- info(...args) {
156
- this._userLogHandler && this._userLogHandler(this, exports.LogLevel.INFO, ...args);
157
- this._logHandler(this, exports.LogLevel.INFO, ...args);
158
- }
159
- warn(...args) {
160
- this._userLogHandler && this._userLogHandler(this, exports.LogLevel.WARN, ...args);
161
- this._logHandler(this, exports.LogLevel.WARN, ...args);
162
- }
163
- error(...args) {
164
- this._userLogHandler && this._userLogHandler(this, exports.LogLevel.ERROR, ...args);
165
- this._logHandler(this, exports.LogLevel.ERROR, ...args);
166
- }
167
- }
168
- function setLogLevel(level) {
169
- instances.forEach(inst => {
170
- inst.setLogLevel(level);
171
- });
172
- }
173
- function setUserLogHandler(logCallback, options) {
174
- for (const instance of instances) {
175
- let customLogLevel = null;
176
- if (options && options.level) {
177
- customLogLevel = levelStringToEnum[options.level];
178
- }
179
- if (logCallback === null) {
180
- instance.userLogHandler = null;
181
- }
182
- else {
183
- instance.userLogHandler = (instance, level, ...args) => {
184
- const message = args
185
- .map(arg => {
186
- if (arg == null) {
187
- return null;
188
- }
189
- else if (typeof arg === 'string') {
190
- return arg;
191
- }
192
- else if (typeof arg === 'number' || typeof arg === 'boolean') {
193
- return arg.toString();
194
- }
195
- else if (arg instanceof Error) {
196
- return arg.message;
197
- }
198
- else {
199
- try {
200
- return JSON.stringify(arg);
201
- }
202
- catch (ignored) {
203
- return null;
204
- }
205
- }
206
- })
207
- .filter(arg => arg)
208
- .join(' ');
209
- if (level >= (customLogLevel !== null && customLogLevel !== void 0 ? customLogLevel : instance.logLevel)) {
210
- logCallback({
211
- level: exports.LogLevel[level].toLowerCase(),
212
- message,
213
- args,
214
- type: instance.name
215
- });
216
- }
217
- };
218
- }
219
- }
5
+ /**
6
+ * @license
7
+ * Copyright 2017 Google LLC
8
+ *
9
+ * Licensed under the Apache License, Version 2.0 (the "License");
10
+ * you may not use this file except in compliance with the License.
11
+ * You may obtain a copy of the License at
12
+ *
13
+ * http://www.apache.org/licenses/LICENSE-2.0
14
+ *
15
+ * Unless required by applicable law or agreed to in writing, software
16
+ * distributed under the License is distributed on an "AS IS" BASIS,
17
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ * See the License for the specific language governing permissions and
19
+ * limitations under the License.
20
+ */
21
+ /**
22
+ * A container for all of the Logger instances
23
+ */
24
+ const instances = [];
25
+ /**
26
+ * The JS SDK supports 5 log levels and also allows a user the ability to
27
+ * silence the logs altogether.
28
+ *
29
+ * The order is a follows:
30
+ * DEBUG < VERBOSE < INFO < WARN < ERROR
31
+ *
32
+ * All of the log types above the current log level will be captured (i.e. if
33
+ * you set the log level to `INFO`, errors will still be logged, but `DEBUG` and
34
+ * `VERBOSE` logs will not)
35
+ */
36
+ exports.LogLevel = void 0;
37
+ (function (LogLevel) {
38
+ LogLevel[LogLevel["DEBUG"] = 0] = "DEBUG";
39
+ LogLevel[LogLevel["VERBOSE"] = 1] = "VERBOSE";
40
+ LogLevel[LogLevel["INFO"] = 2] = "INFO";
41
+ LogLevel[LogLevel["WARN"] = 3] = "WARN";
42
+ LogLevel[LogLevel["ERROR"] = 4] = "ERROR";
43
+ LogLevel[LogLevel["SILENT"] = 5] = "SILENT";
44
+ })(exports.LogLevel || (exports.LogLevel = {}));
45
+ const levelStringToEnum = {
46
+ 'debug': exports.LogLevel.DEBUG,
47
+ 'verbose': exports.LogLevel.VERBOSE,
48
+ 'info': exports.LogLevel.INFO,
49
+ 'warn': exports.LogLevel.WARN,
50
+ 'error': exports.LogLevel.ERROR,
51
+ 'silent': exports.LogLevel.SILENT
52
+ };
53
+ /**
54
+ * The default log level
55
+ */
56
+ const defaultLogLevel = exports.LogLevel.INFO;
57
+ /**
58
+ * By default, `console.debug` is not displayed in the developer console (in
59
+ * chrome). To avoid forcing users to have to opt-in to these logs twice
60
+ * (i.e. once for firebase, and once in the console), we are sending `DEBUG`
61
+ * logs to the `console.log` function.
62
+ */
63
+ const ConsoleMethod = {
64
+ [exports.LogLevel.DEBUG]: 'log',
65
+ [exports.LogLevel.VERBOSE]: 'log',
66
+ [exports.LogLevel.INFO]: 'info',
67
+ [exports.LogLevel.WARN]: 'warn',
68
+ [exports.LogLevel.ERROR]: 'error'
69
+ };
70
+ /**
71
+ * The default log handler will forward DEBUG, VERBOSE, INFO, WARN, and ERROR
72
+ * messages on to their corresponding console counterparts (if the log method
73
+ * is supported by the current log level)
74
+ */
75
+ const defaultLogHandler = (instance, logType, ...args) => {
76
+ if (logType < instance.logLevel) {
77
+ return;
78
+ }
79
+ const now = new Date().toISOString();
80
+ const method = ConsoleMethod[logType];
81
+ if (method) {
82
+ console[method](`[${now}] ${instance.name}:`, ...args);
83
+ }
84
+ else {
85
+ throw new Error(`Attempted to log a message with an invalid logType (value: ${logType})`);
86
+ }
87
+ };
88
+ class Logger {
89
+ /**
90
+ * Gives you an instance of a Logger to capture messages according to
91
+ * Firebase's logging scheme.
92
+ *
93
+ * @param name The name that the logs will be associated with
94
+ */
95
+ constructor(name) {
96
+ this.name = name;
97
+ /**
98
+ * The log level of the given Logger instance.
99
+ */
100
+ this._logLevel = defaultLogLevel;
101
+ /**
102
+ * The main (internal) log handler for the Logger instance.
103
+ * Can be set to a new function in internal package code but not by user.
104
+ */
105
+ this._logHandler = defaultLogHandler;
106
+ /**
107
+ * The optional, additional, user-defined log handler for the Logger instance.
108
+ */
109
+ this._userLogHandler = null;
110
+ /**
111
+ * Capture the current instance for later use
112
+ */
113
+ instances.push(this);
114
+ }
115
+ get logLevel() {
116
+ return this._logLevel;
117
+ }
118
+ set logLevel(val) {
119
+ if (!(val in exports.LogLevel)) {
120
+ throw new TypeError(`Invalid value "${val}" assigned to \`logLevel\``);
121
+ }
122
+ this._logLevel = val;
123
+ }
124
+ // Workaround for setter/getter having to be the same type.
125
+ setLogLevel(val) {
126
+ this._logLevel = typeof val === 'string' ? levelStringToEnum[val] : val;
127
+ }
128
+ get logHandler() {
129
+ return this._logHandler;
130
+ }
131
+ set logHandler(val) {
132
+ if (typeof val !== 'function') {
133
+ throw new TypeError('Value assigned to `logHandler` must be a function');
134
+ }
135
+ this._logHandler = val;
136
+ }
137
+ get userLogHandler() {
138
+ return this._userLogHandler;
139
+ }
140
+ set userLogHandler(val) {
141
+ this._userLogHandler = val;
142
+ }
143
+ /**
144
+ * The functions below are all based on the `console` interface
145
+ */
146
+ debug(...args) {
147
+ this._userLogHandler && this._userLogHandler(this, exports.LogLevel.DEBUG, ...args);
148
+ this._logHandler(this, exports.LogLevel.DEBUG, ...args);
149
+ }
150
+ log(...args) {
151
+ this._userLogHandler &&
152
+ this._userLogHandler(this, exports.LogLevel.VERBOSE, ...args);
153
+ this._logHandler(this, exports.LogLevel.VERBOSE, ...args);
154
+ }
155
+ info(...args) {
156
+ this._userLogHandler && this._userLogHandler(this, exports.LogLevel.INFO, ...args);
157
+ this._logHandler(this, exports.LogLevel.INFO, ...args);
158
+ }
159
+ warn(...args) {
160
+ this._userLogHandler && this._userLogHandler(this, exports.LogLevel.WARN, ...args);
161
+ this._logHandler(this, exports.LogLevel.WARN, ...args);
162
+ }
163
+ error(...args) {
164
+ this._userLogHandler && this._userLogHandler(this, exports.LogLevel.ERROR, ...args);
165
+ this._logHandler(this, exports.LogLevel.ERROR, ...args);
166
+ }
167
+ }
168
+ function setLogLevel(level) {
169
+ instances.forEach(inst => {
170
+ inst.setLogLevel(level);
171
+ });
172
+ }
173
+ function setUserLogHandler(logCallback, options) {
174
+ for (const instance of instances) {
175
+ let customLogLevel = null;
176
+ if (options && options.level) {
177
+ customLogLevel = levelStringToEnum[options.level];
178
+ }
179
+ if (logCallback === null) {
180
+ instance.userLogHandler = null;
181
+ }
182
+ else {
183
+ instance.userLogHandler = (instance, level, ...args) => {
184
+ const message = args
185
+ .map(arg => {
186
+ if (arg == null) {
187
+ return null;
188
+ }
189
+ else if (typeof arg === 'string') {
190
+ return arg;
191
+ }
192
+ else if (typeof arg === 'number' || typeof arg === 'boolean') {
193
+ return arg.toString();
194
+ }
195
+ else if (arg instanceof Error) {
196
+ return arg.message;
197
+ }
198
+ else {
199
+ try {
200
+ return JSON.stringify(arg);
201
+ }
202
+ catch (ignored) {
203
+ return null;
204
+ }
205
+ }
206
+ })
207
+ .filter(arg => arg)
208
+ .join(' ');
209
+ if (level >= (customLogLevel !== null && customLogLevel !== void 0 ? customLogLevel : instance.logLevel)) {
210
+ logCallback({
211
+ level: exports.LogLevel[level].toLowerCase(),
212
+ message,
213
+ args,
214
+ type: instance.name
215
+ });
216
+ }
217
+ };
218
+ }
219
+ }
220
220
  }
221
221
 
222
222
  exports.Logger = Logger;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../src/logger.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type LogLevelString =\n | 'debug'\n | 'verbose'\n | 'info'\n | 'warn'\n | 'error'\n | 'silent';\n\nexport interface LogOptions {\n level: LogLevelString;\n}\n\nexport type LogCallback = (callbackParams: LogCallbackParams) => void;\n\nexport interface LogCallbackParams {\n level: LogLevelString;\n message: string;\n args: unknown[];\n type: string;\n}\n\n/**\n * A container for all of the Logger instances\n */\nexport const instances: Logger[] = [];\n\n/**\n * The JS SDK supports 5 log levels and also allows a user the ability to\n * silence the logs altogether.\n *\n * The order is a follows:\n * DEBUG < VERBOSE < INFO < WARN < ERROR\n *\n * All of the log types above the current log level will be captured (i.e. if\n * you set the log level to `INFO`, errors will still be logged, but `DEBUG` and\n * `VERBOSE` logs will not)\n */\nexport enum LogLevel {\n DEBUG,\n VERBOSE,\n INFO,\n WARN,\n ERROR,\n SILENT\n}\n\nconst levelStringToEnum: { [key in LogLevelString]: LogLevel } = {\n 'debug': LogLevel.DEBUG,\n 'verbose': LogLevel.VERBOSE,\n 'info': LogLevel.INFO,\n 'warn': LogLevel.WARN,\n 'error': LogLevel.ERROR,\n 'silent': LogLevel.SILENT\n};\n\n/**\n * The default log level\n */\nconst defaultLogLevel: LogLevel = LogLevel.INFO;\n\n/**\n * We allow users the ability to pass their own log handler. We will pass the\n * type of log, the current log level, and any other arguments passed (i.e. the\n * messages that the user wants to log) to this function.\n */\nexport type LogHandler = (\n loggerInstance: Logger,\n logType: LogLevel,\n ...args: unknown[]\n) => void;\n\n/**\n * By default, `console.debug` is not displayed in the developer console (in\n * chrome). To avoid forcing users to have to opt-in to these logs twice\n * (i.e. once for firebase, and once in the console), we are sending `DEBUG`\n * logs to the `console.log` function.\n */\nconst ConsoleMethod = {\n [LogLevel.DEBUG]: 'log',\n [LogLevel.VERBOSE]: 'log',\n [LogLevel.INFO]: 'info',\n [LogLevel.WARN]: 'warn',\n [LogLevel.ERROR]: 'error'\n};\n\n/**\n * The default log handler will forward DEBUG, VERBOSE, INFO, WARN, and ERROR\n * messages on to their corresponding console counterparts (if the log method\n * is supported by the current log level)\n */\nconst defaultLogHandler: LogHandler = (instance, logType, ...args): void => {\n if (logType < instance.logLevel) {\n return;\n }\n const now = new Date().toISOString();\n const method = ConsoleMethod[logType as keyof typeof ConsoleMethod];\n if (method) {\n console[method as 'log' | 'info' | 'warn' | 'error'](\n `[${now}] ${instance.name}:`,\n ...args\n );\n } else {\n throw new Error(\n `Attempted to log a message with an invalid logType (value: ${logType})`\n );\n }\n};\n\nexport class Logger {\n /**\n * Gives you an instance of a Logger to capture messages according to\n * Firebase's logging scheme.\n *\n * @param name The name that the logs will be associated with\n */\n constructor(public name: string) {\n /**\n * Capture the current instance for later use\n */\n instances.push(this);\n }\n\n /**\n * The log level of the given Logger instance.\n */\n private _logLevel = defaultLogLevel;\n\n get logLevel(): LogLevel {\n return this._logLevel;\n }\n\n set logLevel(val: LogLevel) {\n if (!(val in LogLevel)) {\n throw new TypeError(`Invalid value \"${val}\" assigned to \\`logLevel\\``);\n }\n this._logLevel = val;\n }\n\n // Workaround for setter/getter having to be the same type.\n setLogLevel(val: LogLevel | LogLevelString): void {\n this._logLevel = typeof val === 'string' ? levelStringToEnum[val] : val;\n }\n\n /**\n * The main (internal) log handler for the Logger instance.\n * Can be set to a new function in internal package code but not by user.\n */\n private _logHandler: LogHandler = defaultLogHandler;\n get logHandler(): LogHandler {\n return this._logHandler;\n }\n set logHandler(val: LogHandler) {\n if (typeof val !== 'function') {\n throw new TypeError('Value assigned to `logHandler` must be a function');\n }\n this._logHandler = val;\n }\n\n /**\n * The optional, additional, user-defined log handler for the Logger instance.\n */\n private _userLogHandler: LogHandler | null = null;\n get userLogHandler(): LogHandler | null {\n return this._userLogHandler;\n }\n set userLogHandler(val: LogHandler | null) {\n this._userLogHandler = val;\n }\n\n /**\n * The functions below are all based on the `console` interface\n */\n\n debug(...args: unknown[]): void {\n this._userLogHandler && this._userLogHandler(this, LogLevel.DEBUG, ...args);\n this._logHandler(this, LogLevel.DEBUG, ...args);\n }\n log(...args: unknown[]): void {\n this._userLogHandler &&\n this._userLogHandler(this, LogLevel.VERBOSE, ...args);\n this._logHandler(this, LogLevel.VERBOSE, ...args);\n }\n info(...args: unknown[]): void {\n this._userLogHandler && this._userLogHandler(this, LogLevel.INFO, ...args);\n this._logHandler(this, LogLevel.INFO, ...args);\n }\n warn(...args: unknown[]): void {\n this._userLogHandler && this._userLogHandler(this, LogLevel.WARN, ...args);\n this._logHandler(this, LogLevel.WARN, ...args);\n }\n error(...args: unknown[]): void {\n this._userLogHandler && this._userLogHandler(this, LogLevel.ERROR, ...args);\n this._logHandler(this, LogLevel.ERROR, ...args);\n }\n}\n\nexport function setLogLevel(level: LogLevelString | LogLevel): void {\n instances.forEach(inst => {\n inst.setLogLevel(level);\n });\n}\n\nexport function setUserLogHandler(\n logCallback: LogCallback | null,\n options?: LogOptions\n): void {\n for (const instance of instances) {\n let customLogLevel: LogLevel | null = null;\n if (options && options.level) {\n customLogLevel = levelStringToEnum[options.level];\n }\n if (logCallback === null) {\n instance.userLogHandler = null;\n } else {\n instance.userLogHandler = (\n instance: Logger,\n level: LogLevel,\n ...args: unknown[]\n ) => {\n const message = args\n .map(arg => {\n if (arg == null) {\n return null;\n } else if (typeof arg === 'string') {\n return arg;\n } else if (typeof arg === 'number' || typeof arg === 'boolean') {\n return arg.toString();\n } else if (arg instanceof Error) {\n return arg.message;\n } else {\n try {\n return JSON.stringify(arg);\n } catch (ignored) {\n return null;\n }\n }\n })\n .filter(arg => arg)\n .join(' ');\n if (level >= (customLogLevel ?? instance.logLevel)) {\n logCallback({\n level: LogLevel[level].toLowerCase() as LogLevelString,\n message,\n args,\n type: instance.name\n });\n }\n };\n }\n }\n}\n"],"names":["LogLevel"],"mappings":";;;;AAAA;;;;;;;;;;;;;;;AAeG;AAuBH;;AAEG;AACI,MAAM,SAAS,GAAa,EAAE,CAAC;AAEtC;;;;;;;;;;AAUG;AACS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AAE,QAAQ,CAAC,IAAI;AACpB,qBAAA,CAAC,CAAC;AACJ,iBAAA;AACH,aAAC,CAAC;AACH,SAAA;AACF,KAAA;AACH;;;;;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../src/logger.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type LogLevelString =\n | 'debug'\n | 'verbose'\n | 'info'\n | 'warn'\n | 'error'\n | 'silent';\n\nexport interface LogOptions {\n level: LogLevelString;\n}\n\nexport type LogCallback = (callbackParams: LogCallbackParams) => void;\n\nexport interface LogCallbackParams {\n level: LogLevelString;\n message: string;\n args: unknown[];\n type: string;\n}\n\n/**\n * A container for all of the Logger instances\n */\nexport const instances: Logger[] = [];\n\n/**\n * The JS SDK supports 5 log levels and also allows a user the ability to\n * silence the logs altogether.\n *\n * The order is a follows:\n * DEBUG < VERBOSE < INFO < WARN < ERROR\n *\n * All of the log types above the current log level will be captured (i.e. if\n * you set the log level to `INFO`, errors will still be logged, but `DEBUG` and\n * `VERBOSE` logs will not)\n */\nexport enum LogLevel {\n DEBUG,\n VERBOSE,\n INFO,\n WARN,\n ERROR,\n SILENT\n}\n\nconst levelStringToEnum: { [key in LogLevelString]: LogLevel } = {\n 'debug': LogLevel.DEBUG,\n 'verbose': LogLevel.VERBOSE,\n 'info': LogLevel.INFO,\n 'warn': LogLevel.WARN,\n 'error': LogLevel.ERROR,\n 'silent': LogLevel.SILENT\n};\n\n/**\n * The default log level\n */\nconst defaultLogLevel: LogLevel = LogLevel.INFO;\n\n/**\n * We allow users the ability to pass their own log handler. We will pass the\n * type of log, the current log level, and any other arguments passed (i.e. the\n * messages that the user wants to log) to this function.\n */\nexport type LogHandler = (\n loggerInstance: Logger,\n logType: LogLevel,\n ...args: unknown[]\n) => void;\n\n/**\n * By default, `console.debug` is not displayed in the developer console (in\n * chrome). To avoid forcing users to have to opt-in to these logs twice\n * (i.e. once for firebase, and once in the console), we are sending `DEBUG`\n * logs to the `console.log` function.\n */\nconst ConsoleMethod = {\n [LogLevel.DEBUG]: 'log',\n [LogLevel.VERBOSE]: 'log',\n [LogLevel.INFO]: 'info',\n [LogLevel.WARN]: 'warn',\n [LogLevel.ERROR]: 'error'\n};\n\n/**\n * The default log handler will forward DEBUG, VERBOSE, INFO, WARN, and ERROR\n * messages on to their corresponding console counterparts (if the log method\n * is supported by the current log level)\n */\nconst defaultLogHandler: LogHandler = (instance, logType, ...args): void => {\n if (logType < instance.logLevel) {\n return;\n }\n const now = new Date().toISOString();\n const method = ConsoleMethod[logType as keyof typeof ConsoleMethod];\n if (method) {\n console[method as 'log' | 'info' | 'warn' | 'error'](\n `[${now}] ${instance.name}:`,\n ...args\n );\n } else {\n throw new Error(\n `Attempted to log a message with an invalid logType (value: ${logType})`\n );\n }\n};\n\nexport class Logger {\n /**\n * Gives you an instance of a Logger to capture messages according to\n * Firebase's logging scheme.\n *\n * @param name The name that the logs will be associated with\n */\n constructor(public name: string) {\n /**\n * Capture the current instance for later use\n */\n instances.push(this);\n }\n\n /**\n * The log level of the given Logger instance.\n */\n private _logLevel = defaultLogLevel;\n\n get logLevel(): LogLevel {\n return this._logLevel;\n }\n\n set logLevel(val: LogLevel) {\n if (!(val in LogLevel)) {\n throw new TypeError(`Invalid value \"${val}\" assigned to \\`logLevel\\``);\n }\n this._logLevel = val;\n }\n\n // Workaround for setter/getter having to be the same type.\n setLogLevel(val: LogLevel | LogLevelString): void {\n this._logLevel = typeof val === 'string' ? levelStringToEnum[val] : val;\n }\n\n /**\n * The main (internal) log handler for the Logger instance.\n * Can be set to a new function in internal package code but not by user.\n */\n private _logHandler: LogHandler = defaultLogHandler;\n get logHandler(): LogHandler {\n return this._logHandler;\n }\n set logHandler(val: LogHandler) {\n if (typeof val !== 'function') {\n throw new TypeError('Value assigned to `logHandler` must be a function');\n }\n this._logHandler = val;\n }\n\n /**\n * The optional, additional, user-defined log handler for the Logger instance.\n */\n private _userLogHandler: LogHandler | null = null;\n get userLogHandler(): LogHandler | null {\n return this._userLogHandler;\n }\n set userLogHandler(val: LogHandler | null) {\n this._userLogHandler = val;\n }\n\n /**\n * The functions below are all based on the `console` interface\n */\n\n debug(...args: unknown[]): void {\n this._userLogHandler && this._userLogHandler(this, LogLevel.DEBUG, ...args);\n this._logHandler(this, LogLevel.DEBUG, ...args);\n }\n log(...args: unknown[]): void {\n this._userLogHandler &&\n this._userLogHandler(this, LogLevel.VERBOSE, ...args);\n this._logHandler(this, LogLevel.VERBOSE, ...args);\n }\n info(...args: unknown[]): void {\n this._userLogHandler && this._userLogHandler(this, LogLevel.INFO, ...args);\n this._logHandler(this, LogLevel.INFO, ...args);\n }\n warn(...args: unknown[]): void {\n this._userLogHandler && this._userLogHandler(this, LogLevel.WARN, ...args);\n this._logHandler(this, LogLevel.WARN, ...args);\n }\n error(...args: unknown[]): void {\n this._userLogHandler && this._userLogHandler(this, LogLevel.ERROR, ...args);\n this._logHandler(this, LogLevel.ERROR, ...args);\n }\n}\n\nexport function setLogLevel(level: LogLevelString | LogLevel): void {\n instances.forEach(inst => {\n inst.setLogLevel(level);\n });\n}\n\nexport function setUserLogHandler(\n logCallback: LogCallback | null,\n options?: LogOptions\n): void {\n for (const instance of instances) {\n let customLogLevel: LogLevel | null = null;\n if (options && options.level) {\n customLogLevel = levelStringToEnum[options.level];\n }\n if (logCallback === null) {\n instance.userLogHandler = null;\n } else {\n instance.userLogHandler = (\n instance: Logger,\n level: LogLevel,\n ...args: unknown[]\n ) => {\n const message = args\n .map(arg => {\n if (arg == null) {\n return null;\n } else if (typeof arg === 'string') {\n return arg;\n } else if (typeof arg === 'number' || typeof arg === 'boolean') {\n return arg.toString();\n } else if (arg instanceof Error) {\n return arg.message;\n } else {\n try {\n return JSON.stringify(arg);\n } catch (ignored) {\n return null;\n }\n }\n })\n .filter(arg => arg)\n .join(' ');\n if (level >= (customLogLevel ?? instance.logLevel)) {\n logCallback({\n level: LogLevel[level].toLowerCase() as LogLevelString,\n message,\n args,\n type: instance.name\n });\n }\n };\n }\n }\n}\n"],"names":["LogLevel"],"mappings":";;;;AAAA;;;;;;;;;;;;;;;AAeG;AAuBH;;AAEG;AACI,MAAM,SAAS,GAAa,EAAE,CAAC;AAEtC;;;;;;;;;;AAUG;AACSA,0BAOX;AAPD,CAAA,UAAY,QAAQ,EAAA;AAClB,IAAA,QAAA,CAAA,QAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAK,CAAA;AACL,IAAA,QAAA,CAAA,QAAA,CAAA,SAAA,CAAA,GAAA,CAAA,CAAA,GAAA,SAAO,CAAA;AACP,IAAA,QAAA,CAAA,QAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAI,CAAA;AACJ,IAAA,QAAA,CAAA,QAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAI,CAAA;AACJ,IAAA,QAAA,CAAA,QAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAK,CAAA;AACL,IAAA,QAAA,CAAA,QAAA,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,GAAA,QAAM,CAAA;AACR,CAAC,EAPWA,gBAAQ,KAARA,gBAAQ,GAOnB,EAAA,CAAA,CAAA,CAAA;AAED,MAAM,iBAAiB,GAA0C;IAC/D,OAAO,EAAEA,gBAAQ,CAAC,KAAK;IACvB,SAAS,EAAEA,gBAAQ,CAAC,OAAO;IAC3B,MAAM,EAAEA,gBAAQ,CAAC,IAAI;IACrB,MAAM,EAAEA,gBAAQ,CAAC,IAAI;IACrB,OAAO,EAAEA,gBAAQ,CAAC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AAC;qBAClB,IAAI,CAAC,GAAG,CAAC,CAAC;AACb,gBAAA,IAAI,KAAK,KAAK,cAAc,aAAd,cAAc,KAAA,KAAA,CAAA,GAAd,cAAc,GAAI,QAAQ,CAAC,QAAQ,CAAC,EAAE;AAClD,oBAAA,WAAW,CAAC;AACV,wBAAA,KAAK,EAAEA,gBAAQ,CAAC,KAAK,CAAC,CAAC,WAAW,EAAoB;wBACtD,OAAO;wBACP,IAAI;wBACJ,IAAI,EAAE,QAAQ,CAAC,IAAI;AACpB,qBAAA,CAAC,CAAC;iBACJ;AACH,aAAC,CAAC;SACH;KACF;AACH;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,17 +1,17 @@
1
- /**
2
- * @license
3
- * Copyright 2017 Google LLC
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- export { setLogLevel, Logger, LogLevel, LogHandler, setUserLogHandler, LogCallback, LogLevelString, LogOptions } from './src/logger';
1
+ /**
2
+ * @license
3
+ * Copyright 2017 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export { setLogLevel, Logger, LogLevel, LogHandler, setUserLogHandler, LogCallback, LogLevelString, LogOptions } from './src/logger';