so-tiny-logger
v1.0.3
Published
A simple logger for Typescript, that can be used to print log (info, error, warning and success) and write it into a file
Downloads
2
Readme
so-tiny-logger
so-tiny-logger
is a simple logger for NodeJS projects. It can be used either with Typescript or Javascript.
Logs are displayed in stdout
and saved in a file.
Methods/functions
/**
* Set the logger's params.
*
* @param baseName the name of your project, '[Logger]' by default
* @param logFile the file that will contain the logs, './logs.txt' by default
*/
static config(baseName: string, logFile: string): void;
/**
* Display a success message
* @param message the message to display
*/
static success(message: string): void;
/**
* Display a warning message
* @param message the message to display
*/
static warning(message: string): void;
/**
* Display an info message
* @param message the message to display
*/
static info(message: string): void;
/**
* Display an error message
* @param message the message to display
*/
static error(message: string): void;
Examples
TypeScript
import {Logger} from 'so-tiny-logger';
Logger.setParams('[YourCoolProjectName]', 'yourlogs.txt');
Logger.info('Some info');
JavaScript
const {Logger} = require('so-tiny-logger');
Logger.setParams('[YourCoolProjectName]', 'yourlogs.txt');
Logger.info('Some info');
File output
[YourCoolProjectName] @ 2/1/22, 8:34 PM - INFO: Some info