Skip to content

Commit

Permalink
feat: logs director change
Browse files Browse the repository at this point in the history
  • Loading branch information
borjar20 committed Nov 4, 2021
1 parent d066327 commit 7463df6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions logger/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ const chalk = require('chalk');
const governify = require('../index');
const { createLogger, format, transports } = require('winston');
const { combine, timestamp, printf } = format;
const fs = require('fs');
let servicePackage = JSON.parse(fs.readFileSync('./package.json'));
require('winston-daily-rotate-file');

function Logger(tags = []) {
Expand Down Expand Up @@ -39,11 +41,11 @@ let logConfig = {
level: LogLevel.INFO,
storage: {
active: false,
level: LogLevel.DEBUG
level: LogLevel.INFO
}
}

let sizeMaxMB = 100;
let sizeMaxMB = 10;
let nFiles = 15;

const fileLogger = createLogger({
Expand Down Expand Up @@ -166,7 +168,7 @@ function setLogConfig(newConfig){
fileLogger.clear();
const files = new transports.DailyRotateFile({
filename: 'logs-%DATE%.log',
dirname:'./logs',
dirname:`./logs/${servicePackage.name}`,
datePattern: 'YYYY-MM-DD',
maxSize:sizeMaxMB + 'm',
maxFiles:nFiles,
Expand Down

0 comments on commit 7463df6

Please sign in to comment.