@crimsonsunset/jsg-logger 1.8.8 → 1.8.9
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/index.js
CHANGED
|
@@ -844,6 +844,8 @@ class JSGLogger {
|
|
|
844
844
|
return {
|
|
845
845
|
core: fallback,
|
|
846
846
|
createLogger: () => fallback,
|
|
847
|
+
getComponent: () => fallback,
|
|
848
|
+
configure: () => {},
|
|
847
849
|
config: {environment: 'fallback'},
|
|
848
850
|
logStore: {getRecent: () => [], clear: () => {}},
|
|
849
851
|
controls: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crimsonsunset/jsg-logger",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Multi-environment logger with smart detection, file-level overrides, and beautiful console formatting. Test it live: https://logger.joesangiorgio.com/",
|
|
6
6
|
"main": "index.js",
|
|
@@ -19,11 +19,18 @@ export const forceEnvironment = (env) => {
|
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
* Check if running in browser environment
|
|
22
|
+
* Check if running in browser environment.
|
|
23
|
+
* Chrome extension service workers run under ServiceWorkerGlobalScope with no
|
|
24
|
+
* window/document, but they are logically a browser context and should use the
|
|
25
|
+
* browser formatter.
|
|
23
26
|
* @returns {boolean}
|
|
24
27
|
*/
|
|
25
28
|
export const isBrowser = () => {
|
|
26
29
|
if (forcedEnvironment) return forcedEnvironment === 'browser';
|
|
30
|
+
const isSW =
|
|
31
|
+
typeof ServiceWorkerGlobalScope !== 'undefined' &&
|
|
32
|
+
self instanceof ServiceWorkerGlobalScope;
|
|
33
|
+
if (isSW) return true;
|
|
27
34
|
return typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
28
35
|
};
|
|
29
36
|
|