logdown.js
logdown.js copied to clipboard
Support global Logdown options
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
});
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.
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.