1
0
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:
Bowden
2018-01-04 18:06:40 -08:00
parent 5e762331d8
commit 1a72f0db6b
5 changed files with 128 additions and 26 deletions

16
src/util/logger.ts Normal file
View 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;