Skip to content

Commit

Permalink
Update readme with new default
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisdaly committed Nov 9, 2019
1 parent f57abf1 commit 62d17c9
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 28 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Edit the file in `./config/default.json` to configure the logger, or set the fol
| `CSL_LOG_LEVEL` | Sets the log level | `info` | `error`, `warn`, `audit`, `trace`, `info`, `perf`, `verbose`, `debug`, `silly` |
| `LOG_FILTER` | _deprecated_ Use `CSL_LOG_FILTER` instead | `""` | e.g. `"error, trace, verbose" |
| `CSL_LOG_FILTER` | Applies a log filter. Specify a comma separated list of individual log levels to be included instead of specifying a `LOG_LEVEL` | `""` | e.g. `"error, trace, verbose" |
| `CSL_LOG_TRANSPORT` | Selects the transport method. Either `console` or `file` | `console` | `console`, `file`
| `CSL_LOG_TRANSPORT` | Selects the transport method. Either `console` or `file` | `file` | `console`, `file`
| `CSL_TRANSPORT_FILE_OPTIONS` | _Optional._ Required if `LOG_TRANSPORT=file`. Configures the winston file transport | See `default.json` | See the [Winston Docs](https://github.com/winstonjs/winston#common-transport-options) |


Expand Down
22 changes: 11 additions & 11 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"faucet": "0.0.1",
"license-checker": "25.0.1",
"npm-audit-resolver": "2.1.0",
"npm-check-updates": "3.2.0",
"npm-check-updates": "3.2.1",
"nyc": "14.1.1",
"pre-commit": "1.2.2",
"proxyquire": "2.1.3",
Expand Down
4 changes: 1 addition & 3 deletions test/unit/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ const Sinon = require('sinon')
const Winston = require('winston')
const Proxyquire = require('proxyquire')
const Logger = require('../../src/index')
const { removeFromCache } = require('../util/index')
const config = require('../../src/lib/config')


Test('logger', function (loggerTest) {
let sandbox
let addMethod
Expand Down Expand Up @@ -44,7 +42,7 @@ Test('logger', function (loggerTest) {
// Arrange
const customConfig = {
...config,
customLevels: 'info, debug',
customLevels: 'info, debug'
}
const LoggerProxy = Proxyquire('../../src/index', {
'./lib/config': customConfig
Expand Down
15 changes: 5 additions & 10 deletions test/unit/lib/config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,16 @@
const Test = require('tapes')(require('tape'))
const Sinon = require('sinon')
const Proxyquire = require('proxyquire')
const { transports } = require('winston')

const { removeFromCache } = require('../../util/index')
const config = require('../../../src/lib/config')


let sandbox = Sinon.createSandbox()
const sandbox = Sinon.createSandbox()
Test('config', (configTest) => {

configTest.afterEach(t => {
delete process.env.LOG_LEVEL
delete process.env.LOG_FILTER
sandbox.restore()


t.end()
})

Expand Down Expand Up @@ -58,7 +53,7 @@ Test('config', (configTest) => {

// Act
try {
const LoggerProxy = Proxyquire('../../../src/index', {
Proxyquire('../../../src/index', {
'./lib/config': customConfig
})
assert.fail('should have thrown error')
Expand All @@ -75,14 +70,14 @@ Test('config', (configTest) => {
// Arrange
const customConfig = {
...config,
logTransport: 'console',
logTransport: 'console'
}

// Act
const LoggerProxy = Proxyquire('../../../src/index', {
'./lib/config': customConfig
})

// Assert
assert.equal(LoggerProxy.transports[0].name, 'console', 'Transport is console')
assert.end()
Expand All @@ -98,7 +93,7 @@ Test('config', (configTest) => {
filename: '/tmp/test'
}
}

// Act
const LoggerProxy = Proxyquire('../../../src/index', {
'./lib/config': customConfig
Expand Down
4 changes: 2 additions & 2 deletions test/util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Remove a certain module or path from node's module cache
* Useful for testing changes in environment variables
* @param {*} pathFragments
* @param {*} pathFragments
*/
const removeFromCache = (pathFragments) => {
pathFragments.forEach(pathFragment => {
Expand All @@ -14,4 +14,4 @@ const removeFromCache = (pathFragments) => {

module.exports = {
removeFromCache
}
}

0 comments on commit 62d17c9

Please sign in to comment.