@account-kit/logging
Advanced tools
Comparing version 4.0.1 to 4.1.0
import { createClientLogger } from "./client.js"; | ||
import { noopLogger } from "./noop.js"; | ||
import { createServerLogger } from "./server.js"; | ||
export function createLogger(context) { | ||
const innerLogger = typeof window === "undefined" | ||
? createServerLogger(context) | ||
: createClientLogger(context); | ||
const innerLogger = (() => { | ||
try { | ||
return typeof window === "undefined" | ||
? createServerLogger(context) | ||
: createClientLogger(context); | ||
} | ||
catch (e) { | ||
console.error("[Safe to ignore] failed to initialize metrics", e); | ||
return noopLogger; | ||
} | ||
})(); | ||
const logger = { | ||
@@ -8,0 +17,0 @@ ...innerLogger, |
@@ -8,4 +8,5 @@ import { AnalyticsBrowser } from "@segment/analytics-next"; | ||
import { DevDestinationPlugin } from "./plugins/devDestination.js"; | ||
import { isClientDevMode } from "./utils.js"; | ||
export function createClientLogger(context) { | ||
const isDev = window.location.hostname.includes("localhost"); | ||
const isDev = isClientDevMode(); | ||
if (isDev && !WRITE_IN_DEV) { | ||
@@ -12,0 +13,0 @@ // If we don't have a write key, we don't want to log anything |
import { createClientLogger } from "./client.js"; | ||
import { noopLogger } from "./noop.js"; | ||
import { createServerLogger } from "./server.js"; | ||
export function createLogger(context) { | ||
const innerLogger = typeof window === "undefined" | ||
? createServerLogger(context) | ||
: createClientLogger(context); | ||
const innerLogger = (() => { | ||
try { | ||
return typeof window === "undefined" | ||
? createServerLogger(context) | ||
: createClientLogger(context); | ||
} | ||
catch (e) { | ||
console.error("[Safe to ignore] failed to initialize metrics", e); | ||
return noopLogger; | ||
} | ||
})(); | ||
const logger = { | ||
@@ -8,0 +17,0 @@ ...innerLogger, |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "4.0.1"; | ||
export declare const VERSION = "4.1.0"; |
// This file is autogenerated by inject-version.ts. Any changes will be | ||
// overwritten on commit! | ||
export const VERSION = "4.0.1"; | ||
export const VERSION = "4.1.0"; | ||
//# sourceMappingURL=version.js.map |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "4.0.1"; | ||
export declare const VERSION = "4.1.0"; | ||
//# sourceMappingURL=version.d.ts.map |
{ | ||
"name": "@account-kit/logging", | ||
"version": "4.0.1", | ||
"version": "4.1.0", | ||
"description": "Core logging library for Account Kit packages", | ||
@@ -64,3 +64,3 @@ "author": "Alchemy", | ||
}, | ||
"gitHead": "840465b053f8fa8971715fc8d9ef4401632f87e4" | ||
"gitHead": "f6b6f15f4fe349850995264a549ca53a821859f0" | ||
} |
@@ -9,2 +9,3 @@ import { AnalyticsBrowser } from "@segment/analytics-next"; | ||
import type { EventsSchema, InnerLogger, LoggerContext } from "./types"; | ||
import { isClientDevMode } from "./utils.js"; | ||
@@ -14,3 +15,3 @@ export function createClientLogger<Schema extends EventsSchema = []>( | ||
): InnerLogger<Schema> { | ||
const isDev = window.location.hostname.includes("localhost"); | ||
const isDev = isClientDevMode(); | ||
if (isDev && !WRITE_IN_DEV) { | ||
@@ -17,0 +18,0 @@ // If we don't have a write key, we don't want to log anything |
import { createClientLogger } from "./client.js"; | ||
import { noopLogger } from "./noop.js"; | ||
import { createServerLogger } from "./server.js"; | ||
@@ -12,6 +13,12 @@ import type { EventLogger, EventsSchema, LoggerContext } from "./types"; | ||
export function createLogger(context: LoggerContext): EventLogger { | ||
const innerLogger = | ||
typeof window === "undefined" | ||
? createServerLogger(context) | ||
: createClientLogger(context); | ||
const innerLogger = (() => { | ||
try { | ||
return typeof window === "undefined" | ||
? createServerLogger(context) | ||
: createClientLogger(context); | ||
} catch (e) { | ||
console.error("[Safe to ignore] failed to initialize metrics", e); | ||
return noopLogger; | ||
} | ||
})(); | ||
@@ -18,0 +25,0 @@ const logger: EventLogger = { |
// This file is autogenerated by inject-version.ts. Any changes will be | ||
// overwritten on commit! | ||
export const VERSION = "4.0.1"; | ||
export const VERSION = "4.1.0"; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43978
70
619