mirror of
https://github.com/microsoft/TypeScript-Node-Starter.git
synced 2025-11-08 15:37:24 +00:00
replaced logging with Winston
This commit is contained in:
16
src/util/logger.ts
Normal file
16
src/util/logger.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import * as winston from "winston";
|
||||
import { ENVIRONMENT } from "./secrets";
|
||||
|
||||
const logger = new (winston.Logger)({
|
||||
transports: [
|
||||
new (winston.transports.Console)({ level: process.env.NODE_ENV === "production" ? "error" : "debug" }),
|
||||
new (winston.transports.File)({ filename: "debug.log", level: "debug"})
|
||||
]
|
||||
});
|
||||
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
logger.debug("Logging initialized at debug level");
|
||||
}
|
||||
|
||||
export default logger;
|
||||
|
||||
Reference in New Issue
Block a user