Skip to content

Commit

Permalink
remove debug, add pino
Browse files Browse the repository at this point in the history
  • Loading branch information
jnovack committed Jul 25, 2018
1 parent 6052986 commit afd385b
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 30 deletions.
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*jshint esversion: 6 */

const log = require('./pino.js');
const bindings = require('bindings')('storm-replay');
const fs = require('fs');
const version = require('./package.json').version;
Expand Down Expand Up @@ -43,6 +44,7 @@ const FILES = [
module.exports = {
version: version,
extractFile: function(Archive, File) {
log.trace("extractFile('" + Archive + "', '" + File + "')");
if (!fs.existsSync(Archive)) {
return {
success: false,
Expand Down Expand Up @@ -109,6 +111,7 @@ module.exports = {
},

getHeader: function(Archive) {
log.trace("getHeader('" + Archive + "')");
if (fs.existsSync(Archive)) {
var ret = bindings.getHeader(Archive);
if (ret.length === undefined) {
Expand Down Expand Up @@ -160,6 +163,7 @@ module.exports = {
* @summary Remove replay.message.events from the MPQ archive.
*/
removeMessages: function(Archive) {
log.trace("removeMessages('" + Archive + "')");
var ret = bindings.removeMessages(Archive);
return ret;
}
Expand Down
120 changes: 91 additions & 29 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
],
"dependencies": {
"bindings": "^1.2.1",
"nan": "^2.10.0"
"nan": "^2.10.0",
"pino": "^4.17.5"
},
"devDependencies": {
"chai": "^4.1.2",
Expand Down
10 changes: 10 additions & 0 deletions pino.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
'use strict'
const pino = require('pino');
const pretty = pino.pretty({forceColor: true})
pretty.pipe(process.stdout);
var loglevel = process.env.LOGLEVEL || 'warn';
module.exports = pino({
name: 'hots-parser',
safe: true,
level: loglevel
}, pretty);

0 comments on commit afd385b

Please sign in to comment.