Skip to content

Commit

Permalink
Winston correction
Browse files Browse the repository at this point in the history
  • Loading branch information
kikislater committed Sep 16, 2024
1 parent 293b533 commit 8416ba2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN apt-get update
RUN apt-get install -y -qq --no-install-recommends software-properties-common build-essential cmake git \
exiv2 libimage-exiftool-perl proj-bin gdal-bin figlet imagemagick pdal libpdal-dev \
libboost-all-dev libtbb-dev libssl-dev libcurl4-openssl-dev pkg-config libpth-dev \
curl libx11-dev python3-pip python3-setuptools python3-shapely
curl libx11-dev python3-pip python3-setuptools python3-shapely apt-utils

RUN pip3 install -U shyaml
RUN pip3 install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org appsettings
Expand Down
18 changes: 10 additions & 8 deletions libs/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,24 @@ try {
logPath += path.sep;
logPath += config.instance + ".log";

let logger = new (winston.Logger)({
transports: [
new (winston.transports.Console)({ level: config.logger.level }),
]
});
logger.add(winston.transports.File, {
let transports = [];
if (!config.deamon){
transports.push(new winston.transports.Console({ level: config.logger.level, format: winston.format.simple() }));
}

let logger = winston.createLogger({ transports });
logger.add(new winston.transports.File({
format: winston.format.simple(),
filename: logPath, // Write to projectname.log
json: false, // Write in plain text, not JSON
maxsize: config.logger.maxFileSize, // Max size of each file
maxFiles: config.logger.maxFiles, // Max number of files
level: config.logger.level // Level of log messages
});
}));

if (config.deamon){
// Console transport is no use to us when running as a daemon
logger.remove(winston.transports.Console);
}

module.exports = logger;
module.exports = logger;

0 comments on commit 8416ba2

Please sign in to comment.