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

Set global callback function for success, error , etc etc #56

Open
joshuaquek opened this issue Jul 9, 2018 · 4 comments
Open

Set global callback function for success, error , etc etc #56

joshuaquek opened this issue Jul 9, 2018 · 4 comments
Labels
feature request Request for a new feature

Comments

@joshuaquek
Copy link

Is your feature request related to a problem? Please describe.
Would it be possible to allow one to set a global callback for each individual log type? Like whenever one calls .success() , it would run a particular callback globally, and if one calls .error() it would also run another global callback etc....same for all of the other logging commands.

Describe the solution you'd like
Allow one to set a global callback for each log command. Success, Error, Fatal, Info... etc etc

@joshuaquek
Copy link
Author

One possible implementation:

const {Signale} = require('signale');

const options = {
  types: {
    error: {
      done: (message) => {
           // Do whatever you want with the logged msg. Log to DB etc.
       }
    },
    success: {
      done: (message) => {
           // Do whatever you want with the logged msg. Log to DB etc.
       }
    }
  }
};

const custom = new Signale(options);
custom.error('Custom Error Log');
custom.success('Custom Success Log');

@klaudiosinani klaudiosinani added the feature request Request for a new feature label Aug 5, 2018
@ansarizafar
Copy link

Any update on this issue?

@zorbyte
Copy link

zorbyte commented Mar 13, 2019

Really could do with this being implemented...

@Vimiso
Copy link

Vimiso commented May 31, 2019

+1!

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

No branches or pull requests

5 participants