A modern logging library for Node.js that provides log level mapping to the console
Installations
npm install loglevelnext
Developer Guide
Typescript
Yes
Module System
CommonJS, ESM
Min. Node Version
>= 18
Node Version
18.16.1
NPM Version
9.5.1
Score
99.4
Supply Chain
100
Quality
75.9
Maintenance
100
Vulnerability
81.3
License
Releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (99.3%)
JavaScript (0.7%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
shellscape
Download Statistics
Total Downloads
232,244,854
Last Day
83,949
Last Week
421,359
Last Month
1,643,762
Last Year
20,664,214
GitHub Statistics
39 Stars
81 Commits
6 Forks
4 Watching
1 Branches
5 Contributors
Bundle Size
4.14 kB
Minified
1.63 kB
Minified + Gzipped
Package Meta Information
Latest Version
6.0.0
Package Id
loglevelnext@6.0.0
Unpacked Size
53.07 kB
Size
11.53 kB
File Count
8
NPM Version
9.5.1
Node Version
18.16.1
Publised On
18 Oct 2023
Total Downloads
Cumulative downloads
Total Downloads
232,244,854
Last day
18%
83,949
Compared to previous day
Last week
33.3%
421,359
Compared to previous week
Last month
32.3%
1,643,762
Compared to previous month
Last year
-21.8%
20,664,214
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
loglevelnext
loglevelnext
is a modern logging library for Node.js and modern browsers, written with modern patterns and practices which provides log level mapping of the console
object.
For browser use, or use in client-side applications, loglevelnext
should be bundled by your preferred bundler or compiler, such as Rollup.
Getting Started
First thing's first, install the module:
1npm install loglevelnext --save
Usage
Users can choose to use loglevelnext
in Node.js or in the client (browser).
1const log = require('loglevelnext'); 2 3log.info('bananas!');
Log Levels
By default loglevelnext
ships supporting the following log level name-value
pairs:
1{ 2 TRACE: 0, 3 DEBUG: 1, 4 INFO: 2, 5 WARN: 3, 6 ERROR: 4, 7 SILENT: 5 8}
Default Logger
When requiring loglevelnext
in Node.js the default export will be an instance of LogLevel
wrapped with some extra sugar.
Methods
Please see LogLevel
for documentation of all methods and properties of every log instance, including the default instance.
trace
, debug
, info
, warn
, error
These methods correspond to the available log levels and accept parameters identical to their console
counterparts. e.g.
1console.info('...'); 2console.info('...'); 3// ... etc
create(options)
Returns a new LogLevel
instance. The options
parameter should be an Object
matching the options for the LogLevel
constructor.
Note: LogLevel
instances created are cached. Calling create
with a previously used name
will return the cached LogLevel
instance. To create a different instance with the same name
, assign a unique id
property to the options
parameter.
Properties
factories
Type: Array [ Class ]
Returns an Array
containing the factory classes available within loglevelnext
to outside modules. Particularly useful when creating plugins. eg.
1const log = require('loglevelnext'); 2const { MethodFactory } = log.factories; 3class MyFactory extends MethodFactory { ... }
loggers
Type: Array [ LogLevel ]
Returns an Array
containing references to the currently instantiated loggers.
Factories aka Plugins
If you're used to using plugins with loglevel
, fear not. The same capabilities
are available in loglevelnext
, but in a much more straightforward and structured
way. loglevelnext
supports by way of "Factories." A Factory
is nothing more
than a class which defines several base methods that operate on the console
and provide functionality to a LogLevel
instance. All factories must inherit from the
MethodFactory
class, and may override any defined class functions.
For an example factory, please have a look at the PrefixFactory
which provides similar functionality as the loglevel-prefix plugin,
and is the factory which is used when a user passes the prefix
option to a
LogLevel
instance.
Browser Support
As mentioned, loglevelnext
is a logging library for Node.js and modern browsers, which means the latest versions of the major browsers. When bundling or compiling loglevelnext
for use in a browser, you should ensure that appropriate polyfills are used. e.g. Internet Explorer typically requires polyfilling both Symbol
and Object.assign
.
Attribution
This project originated as a fork of the much-loved loglevel module, but has diverged and has been rewritten, and now shares similarities only in functional intent.
Base Log SVG by Freepik from www.flaticon.com.
Meta
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: Mozilla Public License 2.0: LICENSE:0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 2/30 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/validate.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/validate.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/shellscape/loglevelnext/validate.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/validate.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/shellscape/loglevelnext/validate.yml/master?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/validate.yml:34
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
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
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 2 are checked with a SAST tool
Reason
16 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
- Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh
Score
2.8
/10
Last Scanned on 2025-01-27
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