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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@sido08/log-easy

v1.0.2

Published

`log-easy` é uma biblioteca para facilitar a aplicação de cores e estilos no console do Node.js. Com `log-easy`, você pode adicionar cores e tags aos logs de maneira simples e intuitiva.

Downloads

195

Readme

log-easy

log-easy é uma biblioteca para facilitar a aplicação de cores e estilos no console do Node.js. Com log-easy, você pode adicionar cores e tags aos logs de maneira simples e intuitiva.

Instalação

Para instalar o log-easy, use o npm:

npm install log-easy

Uso

A biblioteca exporta duas coisas principais:

  • easyLog: uma função para registrar textos coloridos no console.
  • colors: um objeto que contém códigos de cores e estilos que você pode usar.

Importar

Para usar a biblioteca, importe easyLog e colors no seu código:

import { easyLog, colors } from 'log-easy';

Exemplo de Uso

Aqui estão alguns exemplos de como usar a função easyLog para registrar mensagens coloridas no console:

import { easyLog, colors } from 'log-easy';

// Registra uma mensagem em vermelho
easyLog('Hello World', 'red');

// Registra uma mensagem em azul com a tag 'INFO'
easyLog('Hello World', 'blue', 'INFO');

// Registra uma mensagem sem cor se a cor for inválida
easyLog('Hello World', 'invalidColor' as keyof typeof colors.fg);

// Registra uma mensagem sem cor e sem tag se a cor for inválida
easyLog('Hello World', 'invalidColor' as keyof typeof colors.fg, 'WARNING');

Parâmetros

  • text (string): O texto que você deseja registrar.
  • color (keyof typeof colors.fg): A cor que você deseja aplicar ao texto. As opções incluem black, red, green, yellow, blue, magenta, cyan, white, gray.
  • tag (string, opcional): Uma tag opcional que será adicionada antes do texto.

Cores e Estilos

O objeto colors inclui os seguintes estilos e cores:

Estilos

  • reset: \x1b[0m
  • bright: \x1b[1m
  • dim: \x1b[2m
  • underline: \x1b[4m
  • blink: \x1b[5m
  • reverse: \x1b[7m
  • hidden: \x1b[8m

Cores de Texto (fg)

  • black: \x1b[30m
  • red: \x1b[31m
  • green: \x1b[32m
  • yellow: \x1b[33m
  • blue: \x1b[34m
  • magenta: \x1b[35m
  • cyan: \x1b[36m
  • white: \x1b[37m
  • gray: \x1b[90m

Cores de Fundo (bg)

  • black: \x1b[40m
  • red: \x1b[41m
  • green: \x1b[42m
  • yellow: \x1b[43m
  • blue: \x1b[44m
  • magenta: \x1b[45m
  • cyan: \x1b[46m
  • white: \x1b[47m

Testes

Para rodar os testes, use:

npm test

Contribuição

Sinta-se à vontade para contribuir para o log-easy! Abra uma issue ou envie um pull request.

Licença

Distribuído sob a licença MIT. Veja LICENSE para mais informações.