Skip to content

Commit

Permalink
logger: convert js to ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Mersho committed Dec 27, 2023
1 parent 2fbe162 commit 4c53ccb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 27 deletions.
27 changes: 0 additions & 27 deletions logger.js

This file was deleted.

26 changes: 26 additions & 0 deletions logger.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { createLogger, format, config, transports } from "winston";

const level = process.env.LOG_LEVEL || 'notice';

const logger = createLogger({
format: format.combine(
format.timestamp({
format: 'YYYY-MM-DDTHH:mm:ss.SSSZ',
}),
format.colorize(),
format.printf(info => {
return `[${info.timestamp}] ${info.level}: ${info.message} ${info.stack ? info.stack : ''
}`;
})
),
levels: config.syslog.levels,
level,
transports: [
new transports.Console({
handleExceptions: true,
}),
],
exitOnError: false,
});

export { logger };

0 comments on commit 4c53ccb

Please sign in to comment.