###
coffee -cb /opt/node/bb/dev/node_modules/atbar/atbar.cof
coffee /opt/node/bb/dev/node_modules/atbar/tests/logger.cof
###

fs = require 'fs'
atbar = require 'atbar'

log = (path, msg) -> atbar.run 'trace', ->
	fd = null; msg = (''+new Date)[0...24] + '  ' + msg + '\n'
	@_ -> fs.open path, 'a', @$()
	@_ (_throw, d) -> fd = d; fs.write fd, msg, null, null, @$()
	@_ (_throw) -> fs.close fd, @$('exit')
	@_ 'catch', (err) -> console.log 'log() err: ' + err

log '/tmp/logtest', 'hello logging world'

