Gathering detailed insights and metrics for loglevelnext
Gathering detailed insights and metrics for loglevelnext
A modern logging library for Node.js that provides log level mapping to the console
npm install loglevelnext
Typescript
Module System
Min. Node Version
Node Version
NPM Version
99.4
Supply Chain
100
Quality
75.9
Maintenance
100
Vulnerability
81.3
License
TypeScript (99.3%)
JavaScript (0.7%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
232,244,854
Last Day
83,949
Last Week
421,359
Last Month
1,643,762
Last Year
20,664,214
39 Stars
81 Commits
6 Forks
4 Watching
1 Branches
5 Contributors
Minified
Minified + Gzipped
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
Cumulative downloads
Total Downloads
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
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.
First thing's first, install the module:
1npm install loglevelnext --save
Users can choose to use loglevelnext
in Node.js or in the client (browser).
1const log = require('loglevelnext'); 2 3log.info('bananas!');
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}
When requiring loglevelnext
in Node.js the default export will be an instance of LogLevel
wrapped with some extra sugar.
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.
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.
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.
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
.
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.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
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
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
16 existing vulnerabilities detected
Details
Score
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