New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

loguno

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

loguno

One logger, many outlets

latest
Source
npmnpm
Version
2.0.2
Version published
Maintainers
1
Created
Source

LogUno

One logger, many outlets

  • TypeScript supported
  • CommonJS (Node.js) supported
  • ECMAScript Modules (ESM) supported

npm-version npm-downloads

Table of Contents

Installation

npm i loguno # includes type definitions for TypeScript support

Example

./
|__index.js
|__moduleA.js
|__moduleB.js
/* index.js */
import { Level, Logger, Template } from "loguno";
import moduleA from "./moduleA";
import moduleB from "./moduleB";

Logger.addOutlet("index", "var/index.log", {
  isolated: false,
  threshold: Level.WARN,
  template: Template.dlom
});

Logger.logWarn("Message sent from 'index.js'");
Logger.logDebug("Given this outlet's threshold, this will not appear on 'index.log'");

moduleA();
moduleB();

/* moduleA.js */
import { Logger, Level, Template } from "loguno";

export default function main() {
  Logger.addOutlet("moduleA", "var/moduleA.log", {
    isolated: true,
    threshold: Level.TRACE,
    template: Template.lm
  });

  Logger.logInfo("Message sent from 'moduleA.js'. This will only appear on 'moduleA.log'");
  Logger.logWarn("This will appear on both 'index.log' and 'moduleA.log'");
}

/* moduleB.js */
import { Logger } from "loguno";

export default function main() {
  Logger.logWarn("This will only appear on 'index.log'");
}
node index.js

Since Logger starts with one outlet to stdout by default, running the above example would log the following to stdout:

output

The following diagram illustrates what happened:

example

Documentation

See here.

License

MIT

Keywords

logger

FAQs

Package last updated on 15 Jul 2023

Did you know?

Socket

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.

Install

Related posts