Skip to content

🌳 Say hello to your messages in your console!

License

Notifications You must be signed in to change notification settings

HalloSouf/hallo-logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation


HalloLogger 🌳

Say hello to your console

About πŸ“˜

Introducing HalloLogger, a straightforward yet powerful logger designed to bring clarity to your console output. With this logger, you can effortessly create organized and structued logs, making it easier than ever to track and understand your application's behavior. Say goodby to cluttered console screens πŸ‘‹.

Installation πŸ“¦

# With npm
npm install hallo-logger

# With yarn
yarn add hallo-logger

Usage πŸš€

Basic debug messages

This package includes several debug messages that provide insights and create a clear picture of your application's behavior. You can add to these messages a prefix with the prefix option. This will help you identify the source of the message.

const HalloLogger = require('hallo-logger');

const logger = new HalloLogger({ prefix: 'Main' });
logger.ready('Application is ready to serve requests.');
logger.info('Server is listening on port 3000.');
logger.warn('Server is running in development mode.');
logger.error('Failed to connect to database.');

image

By default, the logger will output a message into the console with only the time of the message. However, you can also add the current date to the message by setting the withDate option to true when initializing the logger.

const logger = new HalloLogger({ prefix: 'Main', withDate: true });

image

Ready message

The logger class does also have a static appReady method that can be used to log a ready message. This message will display some important information from the package.json file, such as the application's name and version. You can also add custom information properties to this message.

const HalloLogger = require('hallo-logger');
const express = require('express');

// Get the application's start time
const startMs = Date.now();

// Express app
const app = express();
app.listen(8080);

// Ready message
HalloLogger.appReady(startMs, {
  'πŸšͺ Port': ':8080',
  '🌳 Environment': 'development'
});

image

Note: For this example I used an example with a ExpressJS app. However, this method can be used with any type of application.

License πŸ“œ

This proejct is licensed under the MIT License - see the LICENSE file for details.

About

🌳 Say hello to your messages in your console!

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published