Skip to content

Commit

Permalink
fix: logger notice format not valid
Browse files Browse the repository at this point in the history
  • Loading branch information
cxtom committed Mar 25, 2021
1 parent c07947e commit a864b1e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/logger/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const normalFormat = ':level: :time [:file::line]'
const noticeFormat = ':level: :time [:file::line]'
+ ' errno[:errno] status[:status] logId[:logid]'
+ ' uri[:uri] app[:app] product[:product] module[:module]'
+ ' clientIp[:ip] ua[:ua] refer[:referrer] cookie[:cookie] :notices :performance responseTime[:response-time]';
+ ' clientIp[:ip] ua[:ua] refer[:referrer] cookie[:cookie] :notices tm[:performance] responseTime[:response-time]';

const errorFormat = ':level: :time [:file::line]'
+ ' errno[:errno] status[:status] logId[:logid]'
Expand Down
4 changes: 2 additions & 2 deletions packages/logger/src/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default {
},
notices(o) {
if (isEmpty(o.req?.notices)) {
return '';
return 'request completed';
}
return Object.keys(o.req.notices).map(key => {
const notice = o.req.notices[key];
Expand All @@ -92,7 +92,7 @@ export default {
const pref = o.req.performance[key];
return `${key}:${pref[0]}:${pref[1].toFixed(1)}`;
}).join(' ');
return `tm[${perfStr}]`;
return perfStr;
},
req: function (o, field) {
if (!field) {
Expand Down

0 comments on commit a864b1e

Please sign in to comment.