A simple, easy to use, and customizable logger for Node.js!
npm install ts-monologue
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:
`typescript
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:
`typescript
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: Cyan
- warn: Yellow
- error: Red
- debug: Blue
- success: Green
- loading`: Yellow