JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3279
  • Score
    100M100P100Q89381F
  • License MIT

Simple logger utility

Package Exports

  • @launchql/logger
  • @launchql/logger/esm/index.js
  • @launchql/logger/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@launchql/logger) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@launchql/logger

Simple logger utility with chalk colors for consistent logging across LaunchQL packages.

Installation

npm install @launchql/logger

Features

  • Colored console output using chalk
  • Consistent log formatting
  • Namespace support for identifying log sources
  • Simple API with log, error, and warn methods

Usage

import { Logger } from '@launchql/logger';

// Create a logger with a namespace
const log = new Logger('my-module');

// Log messages
log.log('This is a regular message');
log.error('This is an error message');
log.warn('This is a warning message');

// Messages will be prefixed with the namespace in color
// [my-module] This is a regular message

API

new Logger(namespace: string)

Creates a new logger instance with the given namespace.

Methods

  • log(...args: any[]): void - Log a regular message (cyan namespace)
  • error(...args: any[]): void - Log an error message (red namespace)
  • warn(...args: any[]): void - Log a warning message (yellow namespace)

Example

import { Logger } from '@launchql/logger';

const dbLog = new Logger('database');
const apiLog = new Logger('api');

dbLog.log('Connected to PostgreSQL');
// Output: [database] Connected to PostgreSQL (with cyan [database])

apiLog.error('Failed to fetch user:', error);
// Output: [api] Failed to fetch user: ... (with red [api])

apiLog.warn('Rate limit approaching');
// Output: [api] Rate limit approaching (with yellow [api])