Skip to content

Package

logger v0.5.0

Changelog

seedcordseedcord

The whole Discord bot, typed end to end

Website · Guide · Reference · Discord

npm node bun license

About

@seedcord/logger writes each log line on a named channel, and you set the level per channel. That lets you quiet one part of a program and keep the rest. @seedcord/logger/node adds console and file output through winston.

Both seedcord transports depend on it and re-export it, and every handler, subscriber, and plugin in a bot has a this.logger. Install it directly to use the same logger in a script or a tool outside a bot.

seedcord is pre-1.0, so a minor version can break your code. Each release's changelog says what changed and how to update.

Installation

pnpm add @seedcord/logger envapt

Usage

import { Logger } from '@seedcord/logger';
import { installNodeDefaults } from '@seedcord/logger/node';

installNodeDefaults({ channels: { sync: { level: 'warn' } } });

const logger = new Logger('Sync', { channel: 'sync' });
logger.info('starting'); // hidden, since sync only shows warn and above
logger.warn('retrying after a timeout');

The logging guide covers channels, and the logger config guide covers levels and sinks.