Skip to content

Commit

Permalink
Respect logToFile when logging
Browse files Browse the repository at this point in the history
  • Loading branch information
AlecDusheck committed Jan 9, 2019
1 parent db71d7c commit 61f7e53
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/util/logger.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {SSManager} from "../ssmanager";
import * as path from 'path';
import * as winston from 'winston';
import {transports} from "winston";

class Logger {

Expand Down Expand Up @@ -29,11 +30,20 @@ class Logger {
},
};

this.logger = winston.createLogger({
transports: [
let loggerTransports;
if(logToFile){
loggerTransports = [
new winston.transports.File(options.file),
new winston.transports.Console(options.console)
],
];
}else{
loggerTransports = [
new winston.transports.Console(options.console)
];
}

this.logger = winston.createLogger({
transports: loggerTransports,
exitOnError: false
})
}
Expand Down

0 comments on commit 61f7e53

Please sign in to comment.