Installations
npm install @natlibfi/loglevel-message-prefix
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
7.10.0
NPM Version
4.2.0
Score
70.6
Supply Chain
97.7
Quality
74.5
Maintenance
100
Vulnerability
98.9
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
NatLibFi
Download Statistics
Total Downloads
27,929
Last Day
5
Last Week
148
Last Month
698
Last Year
9,915
GitHub Statistics
15 Stars
36 Commits
5 Forks
8 Watching
2 Branches
13 Contributors
Bundle Size
4.87 kB
Minified
2.01 kB
Minified + Gzipped
Package Meta Information
Latest Version
3.0.1
Package Id
@natlibfi/loglevel-message-prefix@3.0.1
Size
7.60 kB
NPM Version
4.2.0
Node Version
7.10.0
Total Downloads
Cumulative downloads
Total Downloads
27,929
Last day
-82.1%
5
Compared to previous day
Last week
-32.4%
148
Compared to previous week
Last month
60.1%
698
Compared to previous month
Last year
51.6%
9,915
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
loglevel Message prefix plugin
![Test Coverage](https://codeclimate.com/github/NatLibFi/loglevel-message-prefix/badges/coverage.svg)
Plugin for loglevel which allows defining prefixes for log messages
Usage
Installation
Clone the sources and install the package (In the source directory) on command line using npm
:
1npm install
Testing
Run the following NPM script to lint, test and check coverage of the code:
1 2npm run check 3
AMD
1 2define(['loglevel', 'loglevel-message-prefix'], function(log, loglevelMessagePrefix) { 3 4 loglevelMessagePrefix(log, { 5 staticPrefixes: ['foobar'] 6 }); 7 8 log.warn('TEST'); 9 10}); 11
Node.js require
1 2var log = require('loglevel'); 3var loglevelMessagePrefix = require('loglevel-message-prefix'); 4 5loglevelMessagePrefix(log, { 6 staticPrefixes: ['foobar'] 7}); 8 9log.warn('TEST'); 10
Example
Code:
1 2var log = require('loglevel-message-prefix')(require('loglevel'), { 3 prefixes: ['level'], 4 staticPrefixes: ['foo', 'bar'], 5 separator: '/' 6}); 7 8log.setLevel('info'); 9 10log.info('Testing'); 11
Output:
[INFO/foo/bar]: Testing
Configuration
The configuration object is passed as the second argument to the function. Following properties are supported ():
- prefixes: An array of predefined dynamic prefixes that are to be used. Defaults to:
['timestamp', 'level']
. Available prefixes are:- timestamp: Add locale-specific timestamp
- level: Add log level prefix
- staticPrefixes: An array of strings that should be added after dynamic prefixes (E.g. 'foo'). Defaults to none.
- prefixFormat: A string template to format the prefix (
%p
is replaced with the prefix). Defaults to[%p]:
- separator: String used to separate prefixes. Defaults to single whitespace (
- options: Options for dynamic prefixes. Available options are:
- timestamp: An object of properties for date formatting. Available properties are: locale, timezone and hour12. Defaults to
{hour12: false}
- timestamp: An object of properties for date formatting. Available properties are: locale, timezone and hour12. Defaults to
The properties are defined the schema file.
License and copyright
Copyright (c) 2015-2017 University Of Helsinki (The National Library Of Finland)
This project's source code is licensed under the terms of MIT License.
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE.txt:0
- Info: FSF or OSI recognized license: MIT License: LICENSE.txt:0
Reason
Found 2/28 approved changesets -- score normalized to 0
Reason
project is archived
Details
- Warn: Repository is archived.
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 4 are checked with a SAST tool
Score
3
/10
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