Skip to content
This repository has been archived by the owner on Feb 6, 2019. It is now read-only.

Commit

Permalink
Merge pull request #3 from leapfrogtechnology/log-max-files
Browse files Browse the repository at this point in the history
Configure maxFiles option for logging for auto log files removal
  • Loading branch information
deepsadhi authored Jul 5, 2017
2 parents af008a6 + e0bcb87 commit b9903f4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/config/default.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import path from 'path';

export default {
logging: {
maxFiles: 3,
level: 'info',
logDir: 'logs',
jsonFormat: false,
levelColumnWidth: 7,
tsFormat: () => new Date().toISOString(),
dateFormat: 'yyyy-MM-dd'
dateFormat: 'yyyy-MM-dd',
tsFormat: () => new Date().toISOString()
},
db: {
client: 'sqlite3',
Expand Down
3 changes: 3 additions & 0 deletions src/utils/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ function createLogger(config) {
const {
level,
logDir,
maxFiles,
jsonFormat,
dateFormat
} = config;
Expand All @@ -70,10 +71,12 @@ function createLogger(config) {
formatter: opts => customFormatter(opts, config)
}),
new winston.transports.DailyRotateFile({
maxFiles,
align: true,
level: level,
prepend: true,
json: jsonFormat,
zippedArchive: true,
datePattern: dateFormat,
filename: `${logDir}/-log.log`,
formatter: opts => customFormatter(opts, config)
Expand Down

0 comments on commit b9903f4

Please sign in to comment.