-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from arobson/next
0.2.0 - better connection management, API improvements
- Loading branch information
Showing
24 changed files
with
1,010 additions
and
691 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,6 @@ tmp/ | |
spec/ | ||
node_modules/ | ||
coverage/ | ||
.editorconfig | ||
.esformatter | ||
.jshintrc |
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
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,2 @@ | ||
#!/usr/bin/env node | ||
require( './src/repl.js' ); |
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,87 @@ | ||
require( '../setup' ); | ||
var logFn = require( '../../src/log' ); | ||
var mockLog = require( '../mockLogger' )(); | ||
|
||
describe( 'Logging', function() { | ||
describe( 'before initialization', function() { | ||
var log; | ||
before( function() { | ||
log = logFn( 'test' ); | ||
} ); | ||
|
||
it( 'should not throw exceptions', function() { | ||
should.not.throw( function() { | ||
log.debug( 'one' ); | ||
} ); | ||
should.not.throw( function() { | ||
log.info( 'two' ); | ||
} ); | ||
should.not.throw( function() { | ||
log.warn( 'three' ); | ||
} ); | ||
should.not.throw( function() { | ||
log.error( 'four' ); | ||
} ); | ||
} ); | ||
} ); | ||
|
||
describe( 'with debug env set', function() { | ||
var original = process.env.DEBUG; | ||
var log; | ||
before( function() { | ||
process.env.DEBUG = 'test'; | ||
log = logFn( { | ||
adapters: { | ||
'./spec/mockLogger.js': { | ||
level: 5 | ||
} | ||
} | ||
}, 'test' ); | ||
log.debug( 'hello' ); | ||
log.info( 'ignored' ); | ||
log.warn( 'ignored' ); | ||
log.error( 'ignored' ); | ||
} ); | ||
|
||
it( 'should not send log entries to other adapters', function() { | ||
expect( mockLog.test ).to.be.undefined; | ||
} ); | ||
|
||
after( function() { | ||
process.env.DEBUG = original; | ||
} ); | ||
} ); | ||
|
||
describe( 'without debug', function() { | ||
var original = process.env.DEBUG; | ||
var log; | ||
before( function() { | ||
delete process.env.DEBUG; | ||
log = logFn( { | ||
adapters: { | ||
'./spec/mockLogger.js': { | ||
level: 2 | ||
} | ||
} | ||
}, 'test' ); | ||
|
||
log.debug( 'debug' ); | ||
log.info( 'info' ); | ||
log.warn( 'warn' ); | ||
log.error( 'error' ); | ||
} ); | ||
|
||
it( 'should log entries to adapter', function() { | ||
mockLog.test.entries.should.eql( { | ||
error: [ 'error' ], | ||
warn: [ 'warn' ], | ||
info: [], | ||
debug: [] | ||
} ); | ||
} ); | ||
|
||
after( function() { | ||
process.env.DEBUG = original; | ||
} ); | ||
} ); | ||
} ); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.