feat(logger): use logtail only in dev/prod
This commit is contained in:
parent
dc97053d04
commit
2194bcc9ee
@ -2,14 +2,13 @@ import { Logtail } from '@logtail/node'
|
|||||||
import { LogtailTransport } from '@logtail/winston'
|
import { LogtailTransport } from '@logtail/winston'
|
||||||
import winston from 'winston'
|
import winston from 'winston'
|
||||||
|
|
||||||
// Create a Logtail client
|
|
||||||
const logtail = new Logtail(process.env.BETTERSTACK_LOG_TOKEN as string)
|
|
||||||
|
|
||||||
// Create a Winston logger - passing in the Logtail transport
|
// Create a Winston logger - passing in the Logtail transport
|
||||||
export const logger = winston.createLogger({
|
export const logger = winston.createLogger({
|
||||||
transports: [],
|
transports: [],
|
||||||
})
|
})
|
||||||
|
|
||||||
if (import.meta.env.NODE_ENV !== 'test') {
|
if (import.meta.env.NODE_ENV !== 'test') {
|
||||||
|
// Create a Logtail client
|
||||||
|
const logtail = new Logtail(process.env.BETTERSTACK_LOG_TOKEN as string)
|
||||||
logger.add(new LogtailTransport(logtail))
|
logger.add(new LogtailTransport(logtail))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user