consolijs
TypeScript icon, indicating that this package has built-in type declarations

0.0.10 • Public • Published

Consoli js

npm GitHub issues npm GitHub contributors GitHub license PRs Welcome GitHub Repo stars


consoli


Consoli is a new simple and fancy logger that help you even in production mode.

Features

  • ☑ Typescript.
  • ⭐️ tag property of logs.
  • 👁 see logs even in production.
  • ☄️ Colorize tags.

Installation

This module is distributed via npm which is bundled with node and should be installed as one of your project's dependencies:

npm i consolijs

🚨This package is standalone and have no any other dependacy.🚨

Usage

consoliClient.ts

import { Consoli } from "consoli";

export const consoli = new Consoli({

  nodeEnv: import.meta.env.MODE,
  secretKey: import.meta.env.VITE_CONSOLI,
  defaultDeveloperMode: ["SUCCESS"],
  tags: [{ displayName: "myTag", color: "#9f00a1" }],

});

main.ts

import { consoli } from "./consoliClient";

window.consoli = consoli; // for global usage
window.verbose = async () => {
  await consoli.verbose();
};

consoli.log("it a log consoli 💎💎");
consoli.warn("it a warn consoli 🔶🔶");
consoli.error("it a error consoli 🧯🧯");
consoli.success("it a success consoli 🔋🔋");
consoli.tags?.myTag("it a my tag consoli 🍇🍇");

global.d.ts

interface Window {
  verbose: () => Promise<void>;
  consoli: Consoli<"myTag">;
}

Usage in client

Press F12 , go to consol tab and write:

verbose()

And you see :

consoli consoli

Avalilible Params

property type description
onMessageCallback void callback after get the message.
defaultDeveloperMode SUCCESS,INFO,WARN,ERROR default enabled options for developer mode.
tags Array of Tags .

LICENSE

MIT

Package Sidebar

Install

npm i consolijs

Weekly Downloads

3

Version

0.0.10

License

MIT

Unpacked Size

147 kB

Total Files

29

Last publish

Collaborators

  • majid_alinejad