npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

lclog

v1.0.0

Published

Logging utility with banners, JSON output and context-aware formatting (TypeScript)

Readme

lclog

Biblioteca de logging minimalista em TypeScript com saídas formatadas, banners, JSON e contexto encadeável.

Visão geral

lclog fornece uma API simples e encadeável para enriquecer logs com contexto (arquivo, contexto, debug, trace), temas (cores/emoji), formatação de timestamps, renderizações em banner e saída JSON. Foi concebida para ser usada diretamente em projetos TypeScript/Node (pode ser consumida como fonte src/index.ts).

Instalação

Instale via NPM (após publicação):

npm i lclog

Para desenvolvimento local, você pode executar o exemplo com tsx:

# instalação de dependências de execução (se necessário)
npm install
npx tsx src/index.ts

Uso rápido

Importe o cliente clog e use os métodos encadeáveis:

import { Clog } from "lclog";

const clog = new Clog()

clog.info("Hello, World!");
clog.warning("This is a warning message.");
clog.error("This is an error message.");
clog.debug("Debugging information here.");
clog.success("Operation completed successfully.");

clog
  .file('user.service.ts')
  .context('UserService')
  .success('User created successfully');

clog.json({ user: 'John', age: 30 });

clog.banner('Deployment Complete', { color: 'success', width: 80, info: 'v1.0.0' });

clog.divider('=');

API pública

  • clog.file(file: string): retorna uma instância com o campo file anexado ao contexto.

  • clog.context(context: string): adiciona um rótulo de contexto (por ex. nome da classe/subsistema).

  • clog.debug(trace: string), clog.trace(trace: string): armazenam informações de debug/trace no contexto.

  • Níveis de log (cada um registra a mensagem usando o tema apropriado):

    • clog.info(message: string)
    • clog.success(message: string)
    • clog.warning(message: string)
    • clog.error(message: string)
  • clog.json(data: unknown, indent = 2): converte o objeto em JSON formatado e escreve-o (tenta parse quando a entrada é string).

  • clog.banner(message: string, options?: Partial<BannerOptions>): desenha um banner centralizado; options aceita width, color e info.

  • clog.divider(char = '─'): escreve uma linha divisória baseada no comprimento da última linha de saída.

Estrutura e componentes

  • Facade: clog exportado de src/clog/clog.facade.ts — interface encadeável para construir contexto e emitir logs.
  • Logger: ClogLogger monta estratégias de renderização e delega a escrita para um Output.
  • Output: Implementações de saída (ex.: ConsoleOutput) que definem como o conteúdo é escrito e calculam o comprimento da última linha (usado por divider).
  • Formatters: TimestampFormatter, DateTimeFormatter, JsonFormatter — responsáveis por formatar datas e JSON.
  • Builders: ContextPartBuilder, LineBuilder, BannerBoxBuilder — constroem partes do log e banners.
  • Processors: AnsiStripper (limpa códigos ANSI), TextDecorator (aplica cor/estilo em textos).
  • Styling / Themes: ThemeProvider oferece temas por nível (info, success, warning, error, debug) com Color, Style e emoji.

Personalização

  • Para mudar cores/estilos padrão, substitua/instancie ThemeProvider ao criar um LoggerFactory (se exposto) ou modifique ThemeProvider no código.
  • Para direcionar saída a outro destino (arquivo, serviço remoto), implemente a interface Output (write(content: string): void e getLastLineLength(): number) e injete na LoggerFactory.

Exemplos avançados

  • Banner personalizado:
clog.banner('Release', { width: 60, color: 'success', info: 'v2.0.0' });
  • Log com contexto encadeado:
clog.file('auth.ts').context('AuthService').debug('starting authentication').info('user authenticated');

Contribuição

Abra issues e pull requests. Mantenha formato consistente e adicione testes/discussões para mudanças de API.

Licença

MIT