Skip to content

Commit

Permalink
3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
caiogondim committed Aug 1, 2017
1 parent f631ee0 commit 7b2e4fd
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 39 deletions.
34 changes: 16 additions & 18 deletions dist/logdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = function () {
this.opts = Logdown._normalizeOpts(prefix, opts)
this.state = Logdown._getInitialState(this.opts)

Logdown._decorateLoggerMethods(this)
Logdown._instances.push(this)

return this
Expand Down Expand Up @@ -87,26 +88,23 @@ module.exports = function () {
return isEnabled
}

//
// Instance
//

var methods = ['debug', 'log', 'info', 'warn', 'error']
methods.forEach(function (method) {
Logdown.prototype[method] = function () {
if (!this.state.isEnabled) {
return
}
Logdown._decorateLoggerMethods = function (instance) {
Object.keys(instance.opts.logger).forEach(function (method) {
instance[method] = function () {
if (!this.state.isEnabled) {
return
}

var args = toArray(arguments)
var preparedOutput = this._prepareOutput(args, method)
var args = toArray(arguments)
var preparedOutput = this._prepareOutput(args, method)

;(this.opts.logger[method] || this.opts.logger.log).apply(
this.opts.logger,
preparedOutput
)
}
}, this)
;(this.opts.logger[method] || this.opts.logger.log).apply(
this.opts.logger,
preparedOutput
)
}
})
}

return Logdown
}
Expand Down
2 changes: 1 addition & 1 deletion dist/logdown.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified dist/logdown.min.js.gzip
Binary file not shown.
34 changes: 16 additions & 18 deletions example/lib/logdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = function () {
this.opts = Logdown._normalizeOpts(prefix, opts)
this.state = Logdown._getInitialState(this.opts)

Logdown._decorateLoggerMethods(this)
Logdown._instances.push(this)

return this
Expand Down Expand Up @@ -87,26 +88,23 @@ module.exports = function () {
return isEnabled
}

//
// Instance
//

var methods = ['debug', 'log', 'info', 'warn', 'error']
methods.forEach(function (method) {
Logdown.prototype[method] = function () {
if (!this.state.isEnabled) {
return
}
Logdown._decorateLoggerMethods = function (instance) {
Object.keys(instance.opts.logger).forEach(function (method) {
instance[method] = function () {
if (!this.state.isEnabled) {
return
}

var args = toArray(arguments)
var preparedOutput = this._prepareOutput(args, method)
var args = toArray(arguments)
var preparedOutput = this._prepareOutput(args, method)

;(this.opts.logger[method] || this.opts.logger.log).apply(
this.opts.logger,
preparedOutput
)
}
}, this)
;(this.opts.logger[method] || this.opts.logger.log).apply(
this.opts.logger,
preparedOutput
)
}
})
}

return Logdown
}
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "logdown",
"version": "3.0.2",
"version": "3.1.0",
"description": "Debug utility with markdown support that runs on browser and server",
"main": "src/node.js",
"browser": "dist/logdown.min.js",
Expand Down

0 comments on commit 7b2e4fd

Please sign in to comment.