Skip to content

Commit

Permalink
make the auth module use bunyan
Browse files Browse the repository at this point in the history
  • Loading branch information
mercury233 committed Jul 7, 2019
1 parent bba72ce commit a0aeacd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion ygopro-auth.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,16 @@ moment.updateLocale('zh-cn', {
}
})

bunyan = require 'bunyan'
log = bunyan.createLogger name: "auth"

if not fs.existsSync('./logs')
fs.mkdirSync('./logs')

add_log = (message) ->
mt = moment()
log.info(message)
text = mt.format('YYYY-MM-DD HH:mm:ss') + " --> " + message + "\n"
console.log(text)
res = false
try
fs.appendFileSync("./logs/"+mt.format('YYYY-MM-DD')+".log", text)
Expand Down
10 changes: 8 additions & 2 deletions ygopro-auth.js

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

0 comments on commit a0aeacd

Please sign in to comment.