Simple Logger

Usage no npm install needed!

<script type="module">
  import agileTsLogger from 'https://cdn.skypack.dev/@agile-ts/logger';



Simple Javascript Logger

Status GitHub License npm version npm minified size npm total downloads

❓ What is it for?

The Logger is an internal library of AgileTs. Simply put, it is used to log messages into the console. But why a custom Logger and not just using the primitive console.log? Well, some reasons are:

  • filtered log messages
    Filter log messages by tag or type in order to see only logs that matter right now.
  • styled log messages (color, font-weight)
    Style log messages to make it easier to distinguish between different log types and recognise important log messages more quickly.
  • customized log messages (prefix, timestamp)
    Customize log messages to identify searched logs more swiftly.
  • disable logs

▶️ Use case in AgileTs

The Logger Class is used in many AgileTs packages, for:

  • logging different types of log messages,
Agile.logger.log("I'm a log message!");
Agile.logger.debug("I'm a debug message!");
Agile.logger.info("I'm a info message!");
Agile.logger.warn("I'm a warn message!");
Agile.logger.error("I'm a error message!");
Agile.logger.success("I'm a success message!");
Agile.logger.trace("I'm a trace message!");
Agile.logger.custom('jeff', "I'm a custom jeff message!");
  • filtering log messages by log types
Agile.logger.debug('Boring Debug Message.'); // Doesn't get logged
Agile.logger.warn('Important Warning!'); // Does get log
  • filtering log messages by tags
Agile.logger.if.tag(['runtime']).info(`Created Job '${job._key}'`, job);
  • adding a prefix before each log message
Agile.logger.debug('Hello there!'); // Logs: 'Agile: Hello there!'
  • quickly disabling all logs
Agile.logger.isActive = false;
Agile.logger.debug('Boring Debug Message.'); // Doesn't get logged
Agile.logger.warn('Important Warning!'); // Doesn't get logged

📄 Documentation

Sounds AgileTs interesting to you? Checkout our documentation, to learn more. And I promise you, you will be able to use AgileTs in no time. If you have any further questions, don't hesitate to join our Community Discord.

⭐️ Contribute

Get a part of AgileTs and start contributing. We welcome any meaningful contribution. 😀 To find out more about contributing, check out the CONTRIBUTING.md.