Gathering detailed insights and metrics for jet-logger
Gathering detailed insights and metrics for jet-logger
Gathering detailed insights and metrics for jet-logger
Gathering detailed insights and metrics for jet-logger
A super quick, easy to setup logging tool for NodeJS/TypeScript.
npm install jet-logger
Typescript
Module System
Node Version
NPM Version
96.4
Supply Chain
100
Quality
77.7
Maintenance
100
Vulnerability
100
License
TypeScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
17 Stars
46 Commits
2 Forks
1 Watchers
1 Branches
2 Contributors
Updated on Jul 15, 2025
Latest Version
2.0.1
Package Id
jet-logger@2.0.1
Unpacked Size
16.73 kB
Size
5.54 kB
File Count
7
NPM Version
9.8.1
Node Version
18.18.2
Published on
Sep 06, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
A super quick, easy to setup logging tool for NodeJS/TypeScript.
jet-logger is an easy to configure logging tool that allows you change settings via the environment variables (recommended) or manually in code. You can easily switch your logs to be printed out to the command line, written in a file, sent through your own custom logging logic, or turned off completely. Logs printed to the console also are printed out in different colors depending on whether they're info, a warning, an error, etc. The file for holding logs can be specified manually or left as the default. You can also have logs formatted as lines for easy reading or as JSON objects.
1$ npm install --save jet-logger
The logger package's default export is an instance of the JetLogger
class. This default export uses all the default settings. If you wish to pass your own settings you can import the JetLogger
class and pass parameters to the constructor to configure your own custom logger.
JET_LOGGER_MODE
: can be 'CONSOLE'
(default), 'FILE'
, 'CUSTOM'
, and 'OFF'
.JET_LOGGER_FILEPATH
: the file-path for file mode. Default is _home_dir/jet-logger.log_
.JET_LOGGER_FILEPATH_DATETIME
: prepend the log file name with the datetime. Can be 'TRUE'
(default) or 'FALSE'
.JET_LOGGER_TIMESTAMP
: adds a timestamp next to each log. Can be 'TRUE'
(default) or 'FALSE'
.JET_LOGGER_FORMAT
: formats log as a line or JSON object. Can be 'LINE'
(default) or 'JSON'
.logger has an export LoggerModes
which is an enum that provides all the modes if you want to use them in code. I would recommend using Console
for local development, File
for remote development, and Custom
or Off
for production. If you want to change the settings in code, you can do so via importing the JetLogger
class and calling it with whatever options you want.
info
: prints green.imp
: prints magenta.warn
: prints yellow.err
: prints red.There is an optional second param to each method which is a boolean
. If you pass true
as the second param, JetLogger will use node's util
so that the full object gets printed. You should NOT normally use this param, but it is especially useful when debugging errors so that you can print out the full error object and observe the stack trace.
Let's look at some sample code in an express route.
1/* Some script that is run before the route script */ 2 3// Apply logger settings (Note you could also using a tool "dotenv" to set env variables) 4// These must be set before logger is imported 5const logFilePath = path.join(__dirname, '../sampleProject.log'); 6process.env.JET_LOGGER_MODE = LoggerModes.File; // Can also be Console, Custom, or Off 7process.env.JET_LOGGER_FILEPATH = logFilePath; 8 9 10/* In you route script */ 11 12import { OK } from 'http-status-codes'; 13import { Router, Request, Response } from 'express'; 14import logger from 'jet-logger'; 15 16 17const router = Router(); 18 19router.get('api/users/alt', async (req: Request, res: Reponse) => { 20 logger.info(req.params.msg); 21 logger.imp(req.params.msg); 22 logger.warn(req.params.msg); 23 logger.err(req.params.msg); 24 logger.err(new Error('printing out an error')); 25 logger.err(new Error('printing out an error full'), true); // <-- print the full Error object 26 return res.status(OK).json({ 27 message: 'console_mode', 28 }); 29});
[2020-10-11T04:50:59.339Z] INFO: hello jet-logger
[2020-10-11T04:50:59.341Z] IMPORTANT: hello jet-logger
[2020-10-11T04:50:59.341Z] WARNING: hello jet-logger
[2020-10-11T04:50:59.342Z] ERROR: hello jet-logger
[2020-10-11T04:50:59.372Z] ERROR: Error: Demo print full error object
at Object.<anonymous> (C:\Projects\jet-logger\sample-project\src\index.ts:21:12)
at Module._compile (internal/modules/cjs/loader.js:956:30)
at Module.m._compile (C:\Users\seanp\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:536:23)
at Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Object.require.extensions.<computed> [as .ts] (C:\Users\seanp\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:539:12)
at Module.load (internal/modules/cjs/loader.js:812:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)
at main (C:\Users\seanp\AppData\Roaming\npm\node_modules\ts-node\src\bin.ts:212:14)
at Object.<anonymous> (C:\Users\seanp\AppData\Roaming\npm\node_modules\ts-node\src\bin.ts:470:3)
For production you'll probably have some third party logging tool like ElasticSearch or Splunk. logger exports a type TCustomLogFn
that needs to implemented. If you implement this function and pass it to JetLogger and set the mode to CUSTOM
, Logger will call whatever logic you created for it.
1// In the route file 2import { OK } from 'http-status-codes'; 3import { Router, Request, Response } from 'express'; 4import { JetLogger, TCustomLogFn } from 'jet-logger'; 5import { thirdPartyLoggingApp } from 'thirdPartyLoggingApplicationLib'; 6 7 8// Needs to be implemented 9const customSend: TCustomLogFn = (timestamp: Date, level: string, content: unknown) => { 10 thirdPartyLoggingApp.doStuff(...); 11} 12 13router.get('api/users', async (req: Request, res: Reponse) => { 14 const logger = new JetLogger(LoggerModes.CUSTOM, '', true, true, undefined, customSend); 15 logger.info(req.params.msg); 16 return res.status(OK).json({ 17 message: 'console_mode', 18 }); 19});
No vulnerabilities found.
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
no SAST tool detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
13 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
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