🚨 Active Supply Chain Attack:node-ipc Package Compromised.Learn More
Socket
Book a DemoSign in
Socket

@dimjs/logger

Package Overview
Dependencies
Maintainers
3
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dimjs/logger

Simple, pretty and powerful logger for nodejs

latest
npmnpm
Version
2.1.7
Version published
Maintainers
3
Created
Source

@dimjs/logger

Simple, pretty and powerful logger for nodejs

Setup

Initialize

import { logger } from '@dimjs/logger';
logger.debug('hello', 'context');

And customized adapter with builtin sentry

import {
  createLogger,
  SentryAdapter,
  SentryFormatStrategy,
} from '@dimjs/logger';

const logger = createLogger({
  logLevel: LogLevel.Warn,
  adapter: new SentryAdapter({
    formatStrategy: new SentryFormatStrategy(),
  }),
});

logger.debug('hello', 'context');

And customized adapters

// customize custom adapter
export class CustomAdapter<T> implements LogAdapter<T> {
  isLoggable(priority: LogLevel, context?: string | undefined): boolean {
    throw new Error('Method not implemented.');
  }
  config(config?: LogAdapterConfig | undefined): LogAdapter {
    throw new Error('Method not implemented.');
  }
  print(priority: LogLevel, context: string, message: T, trace?: any): void {
    throw new Error('Method not implemented.');
  }
}
// customize custom format strategy for `CustomAdapter`
export class CustomFormatStrategy<T> implements FormatStrategy<T> {
  print(priority: LogLevel, context: string, message: T, trace?: any): void {
    throw new Error('Method not implemented.');
  }
}
// create new logger
const logger = createLogger({
  logLevel: LogLevel.Warn,
  adapter: new SentryAdapter({
    formatStrategy: new SentryFormatStrategy(),
  }),
});

// attach new adapter
logger.addLogAdapter(
  new SentryAdapter({
    formatStrategy: new SentryFormatStrategy(),
  })
);

logger.debug('print multi messages', 'demo');

FAQs

Package last updated on 04 Feb 2026

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