signale icon indicating copy to clipboard operation
signale copied to clipboard

Ability to save as a log file

Open peteryoon11 opened this issue 4 years ago • 4 comments

A clear and concise description of what the problem is.

a setting to save the log file.

or already exist it please notice me

peteryoon11 avatar Jul 29 '19 10:07 peteryoon11

I have the same problem.

Ccj-pro avatar Mar 18 '20 03:03 Ccj-pro

Don't know if that is still going to be helpfull, but you can pass on the options the default stream (process.stderr) and a writableStream to a file: const logger = new Signale({ stream: [process.stderr, fs.createWriteStream('./log.txt')] })

I haven't yet tested if writing to a file degrades the performance somehow, but as it is a writeStream I wouldn't expect any major impact. Also, the file will receive the buffer converted to UTF-8, meaning that the control characters and color codes used to colorize the terminal output are going to appear in the file (eg: [90m [39m). I was able to remove them by creating a wrapper and removing them using the control character (U+001B, 27 in decimal) before passing the stream to Signale, not sure if that is a good way to do it, but worked.

IRegiani avatar Apr 17 '21 22:04 IRegiani

So how did you manage to create the wrapper befor passing the stream. i am no clear on how it is done in code? Could you mayby give an example?

wout-junius avatar Aug 12 '22 14:08 wout-junius

这是来自QQ邮箱的假期自动回复邮件。 您好,我星期六休息,您的信息我会在工作时间,尽快处理。Hello, I'm free on Saturday, your information in time I will work, as soon as possible to deal with.

xianliy avatar Aug 12 '22 14:08 xianliy