Logger: Fix timestamp and format (#5571)
* remove no-op config of logger * add a test to check on the timestamp * add a test to verify that we get non json console loggging by default * configure transports to include timestamps in files * Add failing test to confirm that WinstonLoggerAdapter is not filtering on level. * actually fix the test to refelect the facth that this isn't the problem * Remove bogus date ranges that are now failing becuase we have timestamps.
This commit is contained in:
committed by
Diamond Lewis
parent
81ecf2fd74
commit
87da62bca2
@@ -1,4 +1,4 @@
|
||||
import winston from 'winston';
|
||||
import winston, { format } from 'winston';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import DailyRotateFile from 'winston-daily-rotate-file';
|
||||
@@ -19,9 +19,9 @@ function configureTransports(options) {
|
||||
{
|
||||
filename: 'parse-server.info',
|
||||
json: true,
|
||||
format: format.combine(format.timestamp(), format.json()),
|
||||
},
|
||||
options,
|
||||
{ timestamp: true }
|
||||
options
|
||||
)
|
||||
);
|
||||
parseServer.name = 'parse-server';
|
||||
@@ -32,27 +32,28 @@ function configureTransports(options) {
|
||||
{
|
||||
filename: 'parse-server.err',
|
||||
json: true,
|
||||
format: format.combine(format.timestamp(), format.json()),
|
||||
},
|
||||
options,
|
||||
{ level: 'error', timestamp: true }
|
||||
{ level: 'error' }
|
||||
)
|
||||
);
|
||||
parseServerError.name = 'parse-server-error';
|
||||
transports.push(parseServerError);
|
||||
}
|
||||
|
||||
transports.push(
|
||||
new winston.transports.Console(
|
||||
Object.assign(
|
||||
{
|
||||
colorize: true,
|
||||
name: 'console',
|
||||
silent,
|
||||
},
|
||||
options
|
||||
)
|
||||
)
|
||||
const consoleFormat = options.json ? format.json() : format.simple();
|
||||
const consoleOptions = Object.assign(
|
||||
{
|
||||
colorize: true,
|
||||
name: 'console',
|
||||
silent,
|
||||
format: consoleFormat,
|
||||
},
|
||||
options
|
||||
);
|
||||
|
||||
transports.push(new winston.transports.Console(consoleOptions));
|
||||
}
|
||||
|
||||
logger.configure({
|
||||
|
||||
Reference in New Issue
Block a user