signale
signale copied to clipboard
Ability to save as a log file
A clear and concise description of what the problem is.
a setting to save the log file.
or already exist it please notice me
I have the same problem.
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.
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?
这是来自QQ邮箱的假期自动回复邮件。 您好,我星期六休息,您的信息我会在工作时间,尽快处理。Hello, I'm free on Saturday, your information in time I will work, as soon as possible to deal with.