mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-01-06 22:40:26 -05:00
fix: support localTimeZone for logger pretty-timestamped
format (#984)
* feat: support localTimeZone for logger `pretty-timestamped` format * feat: use `date-fns` to format log time
This commit is contained in:
parent
ee2359abfd
commit
df237fa16a
1 changed files with 2 additions and 1 deletions
|
@ -6,6 +6,7 @@ const chalk = require('chalk');
|
||||||
const Utils = require('./utils');
|
const Utils = require('./utils');
|
||||||
const pkgJSON = require('../../package.json');
|
const pkgJSON = require('../../package.json');
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
|
const {format} = require('date-fns');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Match the level based on buyan severity scale
|
* Match the level based on buyan severity scale
|
||||||
|
@ -101,7 +102,7 @@ function setup(logs) {
|
||||||
} else if (target.format === 'pretty-timestamped') {
|
} else if (target.format === 'pretty-timestamped') {
|
||||||
// making fake stream for pretty pritting
|
// making fake stream for pretty pritting
|
||||||
stream.write = (obj) => {
|
stream.write = (obj) => {
|
||||||
destination.write(`${obj.time.toISOString()}${print(obj.level, obj.msg, obj, destinationIsTTY)}\n`);
|
destination.write(`[${format(obj.time, 'YYYY-MM-DD HH:mm:ss')}] ${print(obj.level, obj.msg, obj, destinationIsTTY)}\n`);
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
stream.write = (obj) => {
|
stream.write = (obj) => {
|
||||||
|
|
Loading…
Reference in a new issue