Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to save as a log file #95

Open
peteryoon11 opened this issue Jul 29, 2019 · 4 comments
Open

Ability to save as a log file #95

peteryoon11 opened this issue Jul 29, 2019 · 4 comments

Comments

@peteryoon11
Copy link

A clear and concise description of what the problem is.

a setting to save the log file.

or already exist it please notice me

@Ccj-pro
Copy link

Ccj-pro commented Mar 18, 2020

I have the same problem.

@IRegiani
Copy link

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.

@wout-junius
Copy link

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?

@xianliy
Copy link

xianliy commented Aug 12, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants