ft-next-logger
Advanced tools
Comparing version 3.0.1 to 4.0.0
@@ -63,2 +63,9 @@ 'use strict'; | ||
module.exports = new Logger(); | ||
const logger = new Logger(); | ||
// set up the logger | ||
logger.addConsole(process.env.NODE_ENV === 'test' ? 'error' : 'info'); | ||
if (process.env.NODE_ENV === 'production' && process.env.SPLUNK_URL) { | ||
logger.addSplunk(process.env.SPLUNK_URL); | ||
} | ||
module.exports = logger; |
{ | ||
"name": "ft-next-logger", | ||
"version": "3.0.1", | ||
"version": "4.0.0", | ||
"main": "main.js", | ||
@@ -17,10 +17,9 @@ "repository": { | ||
"mocha": "^2.2.1", | ||
"npm-prepublish": "^1.2.0", | ||
"next-build-tools": "^5.6.2", | ||
"origami-build-tools": "^4.0.0", | ||
"release-it": "^2.2.2", | ||
"sinon": "^1.17.0" | ||
}, | ||
"engines": { | ||
"node": "4.1.1" | ||
"node": "4.2.1" | ||
} | ||
} |
@@ -8,6 +8,2 @@ # Next Logger [![Circle CI](https://circleci.com/gh/Financial-Times/next-logger.svg?style=svg)](https://circleci.com/gh/Financial-Times/next-logger) | ||
``` | ||
# add a logger | ||
require('ft-next-logger').addConsole(); | ||
# then.. | ||
var logger = require('ft-next-logger').logger; | ||
@@ -23,9 +19,14 @@ logger.info('Saying hello'); | ||
#### Console | ||
By default | ||
`addConsole(level = 'info', opts = {})` | ||
* the `console` logger is added if `NODE_ENV !== production` | ||
* the `splunk` logger is added if `NODE_ENV === production` and there is a `SPLUNK_URL` env variable | ||
#### Splunk | ||
### API | ||
`addSplunk(splunkUrl, level = 'error', opts = {})` | ||
* `addConsole(level = 'info', opts = {})` | ||
* `removeConsole()` | ||
* `addSplunk(splunkUrl, level = 'error', opts = {})` | ||
* `removeSplunk()` | ||
* `clearLoggers()` | ||
@@ -36,3 +37,3 @@ ## Releasing | ||
Version also accepts `minor`, `major`, etc. See the [release-it docs](https://www.npmjs.com/package/release-it#user-content-examples) | ||
Version also accepts `minor` and `major` | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9766
5
278
37
4