This repository has been archived by the owner on Feb 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Debug lib Move debugging to its own library so it can be (re)used in every module instead of just engine.js Furthermore this will expose the current debugging state (in debug.on) globally, use it instead of declaring so.debug locally in each module from process.argv * Picky Travis...
- Loading branch information
Showing
4 changed files
with
45 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const boot = require('../boot') | ||
const moment = require('moment') | ||
|
||
let debug = boot.debug | ||
module.exports = { | ||
flip: function() { | ||
module.exports.on = debug = !debug | ||
}, | ||
msg: function(str) { | ||
if (debug) { | ||
console.error('\n' + moment().format('YYYY-MM-DD HH:mm:ss') + ' - ' + str) | ||
} | ||
}, | ||
on: debug | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters