ts-monologue
v1.2.2
Published
A simple, easy to use, and customizable logger for Node.js!
Downloads
933
Maintainers
Readme
ts-monologue
ts-monologue is a simple, customizable console logger for TypeScript and JavaScript. It allows for detailed logging of outputs, including timestamps, log levels, and custom log messages. ts-monologue is designed to be easy to use and customize, making it a great tool for developers who need to log information about their applications.
Installation
To install ts-monologue, simply run the following command in your terminal:
npm install ts-monologue
Usage
To use ts-monologue, you can import it into your project and use it to log messages. Here is an example of how to use Monologue to log a message:
import { logger } from "ts-monologue";
logger.info("This is an info message.");
logger.warn("This is a warning message.");
logger.error("This is an error message.");
logger.debug("This is a debug message.");
logger.success("This is a success message.");
logger.loading("This is a loading message.");
Customization
ts-onologue allows for detailed customization of the log output. You can customize it to use colors, log to the file, and the log output destination. Here is an example of how to customize ts-monologue:
import { Logger } from "ts-monologue";
const customLogger = new Logger({
useColors: true,
logToFile: true,
logFilePath: "custom.log"
});
customLogger.info("This is a custom log message.");
Options
ts-monologue provides a variety of options for customization. Here are some of the options that are available:
useColors
: Whether to use colors in the log output.logToFile
: Whether to log to a file.logFilePath
: The path to the log file.
Log Levels
ts-monologue supports several log levels with unique colors like the following:
info
: Cyanwarn
: Yellowerror
: Reddebug
: Bluesuccess
: Greenloading
: Yellow