Reduce log trash on native
This commit is contained in:
@@ -103,20 +103,11 @@ export function logEvent<E extends keyof LogEvents>(
|
|||||||
if (Statsig.initializeCalled()) {
|
if (Statsig.initializeCalled()) {
|
||||||
Statsig.logEvent(eventName, null, fullMetadata)
|
Statsig.logEvent(eventName, null, fullMetadata)
|
||||||
}
|
}
|
||||||
// Intentionally call console and bitdrift directly so we can pass rich objects.
|
// Intentionally bypass the logger abstraction to log rich objects.
|
||||||
if (isWeb) {
|
console.groupCollapsed(eventName)
|
||||||
console.groupCollapsed(eventName)
|
console.log(fullMetadata)
|
||||||
console.log(fullMetadata)
|
console.groupEnd()
|
||||||
console.groupEnd()
|
bitdrift.info(eventName, fullMetadata)
|
||||||
} else {
|
|
||||||
bitdrift.info(eventName, fullMetadata)
|
|
||||||
console.log(
|
|
||||||
eventName,
|
|
||||||
'\x1b[2m', // dim
|
|
||||||
fullMetadata,
|
|
||||||
'\x1b[0m', // undim
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// A log should never interrupt the calling code, whatever happens.
|
// A log should never interrupt the calling code, whatever happens.
|
||||||
logger.error('Failed to log an event', {message: e})
|
logger.error('Failed to log an event', {message: e})
|
||||||
|
|||||||
Reference in New Issue
Block a user