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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Included features from issue #56 - Global callback when log type is called #62

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

tiehm
Copy link

@tiehm tiehm commented Sep 15, 2018

This fixes issue #56 you can now set global callbacks for logs which will be called once the logger function is called. The callback function will get the exact same data which the user used.

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

const options = {
  disabled: false,
  interactive: false,
  stream: process.stdout,
  scope: 'custom',
  types: {
    remind: {
      badge: '**',
      color: 'yellow',
      label: 'reminder',
      done: (...msg) => {
        // Do something with the logged message(s)
      }
    },
    santa: {
      badge: '馃巺',
      color: 'red',
      label: 'santa'
    }
  }
};

const custom = new Signale(options);
custom.remind('Improve documentation.');
custom.santa('Hoho! You have an unused variable on L45.');

Calling custom.remind('Hello', ', I love cookies') will get passed to the done callback as ['Hello', ', I love cookies']. You can then use it for whatever logging purposes.

@Vimiso
Copy link

Vimiso commented May 31, 2019

Any update on this?

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

Successfully merging this pull request may close these issues.

None yet

2 participants