npm.io
2.10.1 • Published 8h ago

@hughescr/logger

Licence
Apache-2.0
Version
2.10.1
Deps
4
Size
26 kB
Vulns
0
Weekly
0

Mutation testing badge

Shared logger infrastructure

I had a need for an easy-to-use logger across my various NodeJS projects. This is it. If you like it, feel free also to use it. When I make releases, I push them to npm @hughescr/logger and that is probably the best/safest way to consume this package. The develop branch and other github stuff might break compatibility at any time. master is for releases and is what will be on npm at any given point in time, tagged with release numbers.

Installation

Install the package via npm:

npm install @hughescr/logger

Or with bun:

bun add @hughescr/logger

Basic usage

import { logger } from '@hughescr/logger';

logger.info('starting up');
Express middleware
import express from 'express';
import { middleware } from '@hughescr/logger';

const app = express();
app.use(middleware);

Intercepting console

import { logger } from '@hughescr/logger';

logger.interceptConsole();
console.log('captured');
logger.restoreConsole();

Contributing

Interested in contributing? See CONTRIBUTING.md for development setup, testing guidelines, and our git-flow branching model.

License

This project is licensed under the Apache License 2.0 - see LICENSE.md for details.

Keywords