Simple logger for frontend applications
npm install @sacoding/logging.js

logging.js is a library providing logging for frontend applications
``sh`
npm install --save @sacoding/logging.js
To use logging.js import it in javascript file and get default logger by calling getLogger method.
`js
import Logging from '@sacoding/logging.js';
const loggger = Logging.getLogger();
logger.debug('foo', { bar: 1 });
`
Logging class has static method setLogger which can be used to define new loggers.
Each logger has to have following static methods:
- debug,info
- ,notice
- ,warning
- ,error
- ,critical
- ,alert
- ,emergency
- .
Convention used in predefined loggers is to handle two parameters for each method:
- first for message which is string,context
- second for which is object.
`js
import Logging from '@sacoding/logging.js';
class FooLogger {
static emergency = () => {};
static alert = () => {};
static critical = () => {};
static error = () => {};
static warning = () => {};
static notice = () => {};
static info = () => {};
static debug = () => {};
}
Logging.setLogger('foo', FooLogger, false);
`
Third parameter of Logging::setLogger method is used to set new logger as default one if it is true.
To log with new logger call:
`js``
const fooLogger = Logging.getLogger('foo');
fooLogger.debug('bar');