Gathering detailed insights and metrics for loglevel-prefix-persist
Gathering detailed insights and metrics for loglevel-prefix-persist
Gathering detailed insights and metrics for loglevel-prefix-persist
Gathering detailed insights and metrics for loglevel-prefix-persist
npm install loglevel-prefix-persist
Typescript
Module System
Node Version
NPM Version
47
Supply Chain
94.5
Quality
74.9
Maintenance
100
Vulnerability
99.6
License
JavaScript (100%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
3,090
Last Day
1
Last Week
1
Last Month
26
Last Year
159
14 Commits
2 Forks
1 Watching
1 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
1.0.3
Package Id
loglevel-prefix-persist@1.0.3
Size
3.67 kB
NPM Version
3.8.9
Node Version
6.2.0
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
-75%
1
Compared to previous week
Last month
271.4%
26
Compared to previous month
Last year
-15.9%
159
Compared to previous year
loglevel plugin - Support for the following:
Uses
#Usage Assuming the following simple config
1var logCfg = { 2 "level":{ 3 "production": "warn", 4 "development": "info" 5 }, 6 "persist":"error", 7 "max":2 8}
On server side, initialize plugin in server.js
1 2var loglevel = require('loglevel'); 3var logger = require('loglevel-prefix-persist/server') 4var log = logger(process.env.NODE_ENV, loglevel, logCfg); 5 6 7var app = express(); 8app 9 .use(bodyParser.urlencoded({ extended: false })) 10 .use(bodyParser.json()) 11 12//... 13 14if (log.writer) { 15 // if client log persistence is enabled, this will accept and writes logs coming from client side 16 app.use(log.writer); 17} 18 19
On client side, initialize plugin in client.js entry
1var loglevel = require('loglevel'); 2var logger = require('loglevel-prefix-persist/client'); 3var log = logger('development', loglevel, logCfg); 4
All together (for both client and server)
1 2// namespacing modules 3var log = require('loglevel').getLogger("my/module-name"); 4 5// start logging 6log.debug('Debug will not show') 7log.info('Info will show under development, but not in production','config',logCfg) 8log.warn('Warn will always show') 9log.error('Error will always show')
#Result server
client
#Config
Config examples:
1 2// log level='warn', server persistence only (at 'warn'), log daily forever 3var logCfg = { 4 "level":"warn" 5} 6 7// log level for client+server, no persistence 8var logCfg = { 9 "level": {"server":"info", "client":"warn"}, // regardless of environment 10 "persist":false 11} 12 13// log level for production+development, persist for level='error', max 2 days log 14var logCfg = { 15 "level":{ 16 "production": "warn", 17 "development": "info" 18 }, 19 "persist":"error", 20 "max":2 21} 22 23// cfg for production+developement, client+server 24var logCfg = { 25 "level":{ 26 "production": {"server":"info", "client":"warn"}, 27 "development": "debug" 28 }, 29 "persist":{ 30 "client":"error", // only persist client level='error' 31 "server":true // persist server 'debug' in development, 'info' in production 32 }, 33 "max":2 34} 35 36
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
Found 0/14 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-02-03
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More