0.0.10 β’ Published 9 months ago
consolijs v0.0.10
Consoli js
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 :
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