@ntf/logger v1.1.0
@ntf/logger
Another console logger library
Why
Because I like reinventing the wheel :)
Installation
Use your favourite package manager, idk
npm install @ntf/loggeryarn add @ntf/loggerpnpm install @ntf/loggerUsage
Importing
This library can be used in CommonJS and ESModule environments
const { ... } = require("@ntf/logger");import { ... } from "@ntf/logger";Creating a logger
You can use createLogger to create a logger based on the runtime you are using (browser, server, etc.)
const logger = createLogger("MyLoggerName")But you can use the implementations directly if you want
For servers
For servers there's AnsiLogger class which you can guess, uses escaped ansi code for colors in termnial/console/command prompt/whatever terminal name
For browsers
For browsers there's CSSLogger class which uses the cool feature of CSS styling, you can try AnsiLogger but on some browsers it looks weird (especially Chrome)
I want to make my own Logger
Just extend the Logger class and implement print:
class MyCoolAndAwesomeLogger extends Logger
{
// level = can be "info", "warn", "error", "debug" or "trace"
// args = well... anything... literally
print(level,...args)
{
// do some funny stuff here
}
};License stuff that nobody reads
Just like any Open Source Project this has a License, the MIT License