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

rolling file AND console #58

Open
colorao opened this issue Mar 16, 2020 · 2 comments
Open

rolling file AND console #58

colorao opened this issue Mar 16, 2020 · 2 comments

Comments

@colorao
Copy link

colorao commented Mar 16, 2020

Hi !!
I'd like to set it up to write a rolling file log, AND ALSO, to throw messages to the console.
But in the examples I've just found createSimpleLogger or createRollingFileLogger.
Is there a way to configure both of them?
Thanks in advanced ...

@AidanNichol
Copy link

How do to it is buried in the category-logger.js example. Here is how I'm doing it in my app

const SimpleNodeLogger = require('simple-node-logger');
const manager = new SimpleNodeLogger();
const opts = {
  logDirectory: 'server/logs', // NOTE: folder must exist and be writable...
  fileNamePattern: 'steds-server-<DATE>.log',
  dateFormat: 'YYYY.MM.DD',
};
manager.createConsoleAppender();
manager.createRollingFileAppender(opts);
const logger = manager.createLogger();
module.exports.logger = logger;

@TimDaub
Copy link

TimDaub commented Sep 16, 2020

Tested this in my app too. Works. Issue can be closed IMO.

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

3 participants