You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I've been using Consola for a long time, It's very nice.
I found that FancyReporter log right date is not work in PM2, so I check source code, I found process.stdout.columns is undefined in PM2 pty, beause PM2 is not run in a terminal simulator.
So, there is a way to put the time on the right on the left if columns is 0, or provide a option like dateAlign: 'right' | 'left'
Current, I hack it if check env is in pty(no terminal simulator) and then replace consola output string.
// this is my hackclassReporterextendsFancyReporter{isInVirtualTerminal=typeofprocess.stdout.columns==='undefined'// HACK: if got `undefined` that means in PM2 ptyprotectedformatDate(date: Date): string{returnthis.isInVirtualTerminal ? '' : super.formatDate(date)}protectedformatLogObj(): string{returnthis.isInVirtualTerminal
? (chalk.gray(getShortTime(newDate()))+' '+super.formatLogObj.apply(this,arguments).replace(/^\n/,'')).trimEnd()
: super.formatLogObj.apply(this,arguments)}}
Hi, I've been using Consola for a long time, It's very nice.
I found that
FancyReporter
log right date is not work in PM2, so I check source code, I foundprocess.stdout.columns
isundefined
in PM2 pty, beause PM2 is not run in a terminal simulator.consola/src/reporters/basic.js
Line 63 in abb016f
Width will set to
0
if columns isundefined
. But if width is0
, space will ignore, and right date will be ignore too.consola/src/reporters/fancy.js
Lines 77 to 81 in abb016f
So, there is a way to put the time on the right on the left if columns is
0
, or provide a option likedateAlign: 'right' | 'left'
Current, I hack it if check env is in pty(no terminal simulator) and then replace consola output string.
To reproduce
This is my simple code.
Run in pm2:
Output (in PM2):
Expect
Put right date to left, if process.stdout.columns is
undefined
.The text was updated successfully, but these errors were encountered: