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

Support global Logdown options #67

Open
bennycode opened this issue Dec 22, 2016 · 2 comments
Open

Support global Logdown options #67

bennycode opened this issue Dec 22, 2016 · 2 comments

Comments

@bennycode
Copy link
Collaborator

It would be nice if you could set a preset for every newly created Logdown instance.

Example:

If I always want to have logger instances which don't render Markdown but align output, I should be able to do something like this:

Logdown.preset({
  alignOuput: true,
  markdown: false
});

var firstLogger = new Logdown({prefix: 'firstLogger'});
var secondLogger = new Logdown({prefix: 'secondLogger'});

This should be equivalent to:

var firstLogger = new Logdown({
  prefix: 'firstLogger',
  alignOuput: true,
  markdown: false
});

var secondLogger = new Logdown({
  prefix: 'secondLogger',
  alignOuput: true,
  markdown: false
});
@caiogondim
Copy link
Owner

I like the idea.

But we should have a getter and setter for this.

What you think about just exposing an object?

Logdown.opts = {
  alignOutput: true,
  markdown: false
}

Then to change it, you could do:

Logdown.opts.markdown = false

// or

Logdown.opts = Object.assign({}, Logdown.opts, {markdown: true})

Feels more idiomatic

And on https://github.com/caiogondim/logdown.js/blob/master/src/index.js#L62 we just do Object.assign before creating a new object.

@stale
Copy link

stale bot commented Oct 10, 2017

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Oct 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants