@ozmap/logger
TypeScript icon, indicating that this package has built-in type declarations

0.2.3 • Public • Published

OZLogger

DevOZ logger module.


Available log methods

The available methods are presented in level hierarchy order.

  • .debug(...messages: any[])
  • .audit(...messages: any[])
  • .info(...messages: any[])
  • .warn(...messages: any[])
  • .error(...messages: any[])

Usage examples

Here is a simple code snippet example of using the OZLogger with typescript:

import createLogger from '@ozmap/logger';

// Initialize and configure the logging facility
const OZLogger = createLogger();

// Example of simple debug log
OZLogger.debug("Simple test log");

If you are using the OZLogger with javascript:

const createLogger = require('@ozmap/logger');

// Initialize and configure the logging facility
const OZLogger = createLogger();

// Example of simple debug log
OZLogger.debug("Simple test log");

The above snippet can even be improved to:

// Initialize and configure the logging facility right after importing it
const OZLogger = require('@ozmap/logger')();

// Example of simple debug log
OZLogger.debug("Simple test log");

Changing log levels

In order to change the log level at runtime the following HTTP request can be made:

POST http://localhost:9898/changeLevel
{
    "level": "<log-level>",
    "duration": <milliseconds>
}
curl -L -X POST -H 'Content-Type: application/json' -d '{"level":"<log-level>","duration":<milliseconds>}' http://localhost:9898/changeLevel

Readme

Keywords

Package Sidebar

Install

npm i @ozmap/logger

Weekly Downloads

94

Version

0.2.3

License

MIT

Unpacked Size

46.3 kB

Total Files

45

Last publish

Collaborators

  • czirkeosta-ozmap
  • rogerbambinettidevoz
  • leonardorbk
  • leandro.schabarum
  • vinicius_lunardi_ozmap
  • jose.raupp
  • mateuscsouza