Skip to content
/ log Public

A very basic logging utility with no dependencies.

License

Notifications You must be signed in to change notification settings

nashaddams/log

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

log

A very basic logging utility with no dependencies.

JSR JSR Score

Console logging

import { Log } from "@nashaddams/log";

const log = Log.init();

log.debug(...); // No output with default log level `warn`
log.info(...);  // No output with default log level `warn`
log.warn(...);  // 2024-03-01T12:34:56.789Z WARN ...
log.error(...); // 2024-03-01T12:34:56.789Z ERROR ...

File logging

import { Log } from "@nashaddams/log";

const log = Log.init({
  level: "debug",
  target: ["file"],
  prefix: "[consumer]",
  filePath: "consumer.log",
});

log.debug(...); // 2024-03-01T12:34:56.789Z DEBUG [consumer] ...
log.info(...);  // 2024-03-01T12:34:56.789Z INFO [consumer] ...
log.warn(...);  // 2024-03-01T12:34:56.789Z WARN [consumer] ...
log.error(...); // 2024-03-01T12:34:56.789Z ERROR [consumer] ...

About

A very basic logging utility with no dependencies.

Resources

License

Stars

Watchers

Forks

Packages

No packages published