Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (rec.level < bunyan.INFO) {
console.log(rec);
} else if (rec.level < bunyan.WARN) {
console.info(rec);
} else if (rec.level < bunyan.ERROR) {
console.warn(rec);
} else {
console.error(rec);
}
}
}
// TODO(perry) teach flow about the logger type here
let logger: any = bunyan.createLogger({
name: 'expo',
serializers: bunyan.stdSerializers,
streams: [
{
level: 'debug',
type: 'rotating-file',
path: path.join(UserSettings.dotExpoHomeDirectory(), 'log'),
period: '1d', // daily rotation
count: 3, // keep 3 back copies
},
...(process.env.DEBUG && process.env.NODE_ENV !== 'production'
? [
{
type: 'raw',
stream: new ConsoleRawStream(),
closeOnExit: false,
level: 'debug',
},
write(record: any) {
if (record.level < bunyan.INFO) {
console.log(record);
} else if (record.level < bunyan.WARN) {
console.info(record);
} else if (record.level < bunyan.ERROR) {
console.warn(record);
} else {
console.error(record);
}
}
}
const logger = bunyan.createLogger({
name: 'expo',
serializers: bunyan.stdSerializers,
streams:
process.env.DEBUG && process.env.NODE_ENV !== 'production'
? [
{
type: 'raw',
stream: new ConsoleRawStream(),
closeOnExit: false,
level: 'debug',
},
]
: [],
});
export type LogStream = bunyan.Stream;
export type Log = bunyan;