1.0.3 • Published 2 years ago

so-tiny-logger v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

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
1.0.2

2 years ago

1.0.3

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago