
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
🚧 Work in progress (pre-release) 🚧
Simplistic logging for node.js with extensive TypeScript support.
npm i logita
There are several logging libraries, but none of them seem to suite these needs:
console.log or console.errorlog.createLoggers. Export the created logging object for your project needs.// /app/src/some-file.ts
import { log } from "logita";
log.debug("Wow, this is cool!");
![[Tue, 22 May 2018 20:32:41 GMT] /app/src/some-file.ts:3:5 [DEBUG] Wow, this is cool!](https://github.com/jlaamanen/logita/raw/HEAD/images/example-config-1.png?raw=true)
// /app/src/log.ts
import { createLoggers } from "logita";
export default createLoggers({
showFile: false,
// Use Moment.js format to format the timestamp!
timestamp: "DD.MM.YYYY HH:mm:ss"
});
// /app/src/another-file.ts
import log from "./log";
log.debug("Wow, this is cool!");
![[22.05.2018 23:33:15] [DEBUG] Wow, this is cool!](https://github.com/jlaamanen/logita/raw/HEAD/images/example-config-2.png?raw=true)
import { createLoggers } from "logita";
// Use chalk to define log level colors!
import chalk from "chalk";
export default createLoggers({
levels: {
important: {
priority: 0,
color: chalk.bgRed.white,
text: "UH-OH"
},
notSoImportant: {
priority: 1,
color: chalk.yellow,
text: "meh"
},
silly: {
priority: 2,
color: chalk.green
}
},
showFile: true,
timestamp: "YYYY-MM-DD HH:mm:ss"
});
// /app/src/another-file.ts
import log from "./log";
log.important("Alarm!");
log.notSoImportant("Hello world");
log.silly("How do you do");
![[2018-05-22 23:33:32] /app/src/another-file.ts:3:5 [UH-OH] Alarm!
[2018-05-22 23:33:32] /app/src/another-file.ts:4:5 [meh] Hello world
[2018-05-22 23:33:32] /app/src/another-file.ts:5:5 [SILLY] How do you do](https://github.com/jlaamanen/logita/raw/HEAD/images/example-config-3.png?raw=true)
Need to track times on chains of requests or other asynchronous functions? Because of the repetitive nature of such logging, logita provides log spans. Just create a log span with a default logging level and a name between the parentheses:
import { log } from "logita";
const span = log.span.debug("My span");
After this you can log the span with splitTime, success and fail logging functions:
const span = log.span.debug("My span");
try {
await doSomething();
span.splitTime();
await doSomethingElse();
span.splitTime();
await doSomethingFinal();
span.success();
} catch (error) {
span.fail();
}

You can also give a message for the functions to be more verbose:
const span = log.span.debug("My span");
try {
await doSomething();
span.splitTime("First request done");
await doSomethingElse();
span.splitTime("Second request done");
await doSomethingFinal();
span.success("Finally finished");
} catch (error) {
span.fail("Something went wrong");
}

Note: Only use messages of type
string, because span logs should not log actual data. For that, please use the normal logging functions.
To take things even further, you can also log each message with a different level from the default one:
const span = log.span.debug("My span");
try {
await doSomething();
span.info.splitTime("First request done");
await doSomethingElse();
span.verbose.splitTime("Second request done");
await doSomethingFinal();
span.info.success("Finally finished");
} catch (error) {
span.fatal.fail("Something went wrong");
}

Returns an object containing a simple logging function for each given logging level.
fatal (0)error (1)warning (2)info (3)verbose (4)debug (5)chalk.bgBlack.bold.whitestderr instead of stdout?falsetrueprocess.env.MIN_LOG_LEVEL, but if none is found, everything gets loggedfalse, timestamp is not showntrue, timestamp is shown with Date.prototype.toUTCStringtrue, i.e. show timestamp with Date.prototype.toUTCStringtruestdout outputconsole.logstderr outputconsole.errorDefault config:
{
{
levels: {
fatal: {
priority: 0,
color: chalk.bgRedBright.white,
stderr: true
},
error: {
priority: 1,
color: chalk.bgBlack.red,
stderr: true
},
warning: {
priority: 2,
color: chalk.bgBlack.yellow
},
info: {
priority: 3,
color: chalk.bgBlack.blue
},
verbose: {
priority: 4,
color: chalk.bgBlack.green
},
debug: {
priority: 5,
color: chalk.inverse.bgWhite.gray
}
}
},
span: {
showSplitDifference: true
}
showFile: true,
timestamp: true,
minLevel: process.env.LOG_MIN_LEVEL || undefined,
stdout: console.log,
stderr: console.error
}
Example log messages with default config:
![[Tue, 22 May 2018 20:35:24 GMT] /app/src/some-file.ts:3:5 [FATAL] This is a fatal log message!!
[Tue, 22 May 2018 20:35:24 GMT] /app/src/some-file.ts:4:5 [ERROR] This is an error log message!
[Tue, 22 May 2018 20:35:24 GMT] /app/src/some-file.ts:5:5 [WARNING] This is a warning
[Tue, 22 May 2018 20:35:24 GMT] /app/src/some-file.ts:6:5 [INFO] This is informational
[Tue, 22 May 2018 20:35:24 GMT] /app/src/some-file.ts:7:5 [VERBOSE] This is quite verbose
[Tue, 22 May 2018 20:35:24 GMT] /app/src/some-file.ts:8:5 [DEBUG] This is for debugging purposes](https://github.com/jlaamanen/logita/raw/HEAD/images/default-config.png?raw=true)
FAQs
Simple logger with extensive TypeScript support
The npm package logita receives a total of 1 weekly downloads. As such, logita popularity was classified as not popular.
We found that logita demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.