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
@@ -39,6 +39,36 @@ describe('WinstonLogger', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should have a timestamp', done => {
|
||||
logging.logger.info('hi');
|
||||
logging.logger.query({ limit: 1 }, (err, results) => {
|
||||
if (err) {
|
||||
done.fail(err);
|
||||
}
|
||||
expect(results['parse-server'][0].timestamp).toBeDefined();
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('console should not be json', done => {
|
||||
// Force console transport
|
||||
reconfigureServer({
|
||||
logsFolder: null,
|
||||
silent: false,
|
||||
})
|
||||
.then(() => {
|
||||
spyOn(process.stdout, 'write');
|
||||
logging.logger.info('hi', { key: 'value' });
|
||||
expect(process.stdout.write).toHaveBeenCalled();
|
||||
const firstLog = process.stdout.write.calls.first().args[0];
|
||||
expect(firstLog).toEqual('info: hi {"key":"value"}' + '\n');
|
||||
return reconfigureServer();
|
||||
})
|
||||
.then(() => {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should enable JSON logs', done => {
|
||||
// Force console transport
|
||||
reconfigureServer({
|
||||
|
||||
Reference in New Issue
Block a user