Stored Logger
When we build a logger, it's saved in Loggerage cache and can be retrieved by getLogger
static method:
getLogger
Declaration:
.getLogger( app: string ): Loggerage
Example:
const { Loggerage, LoggerageLevel } = require("loggerage");
const logger = new Loggerage("MY-APP");
logger.debug("Hello world!");
// and after
const logger = Loggerage.getLogger("MY-APP");
logger.debug("Hello again world!");
Every time we build a logger with the same name, the previous one is overwritten.
destroy
In addition, we can also destroy a stored logger by destroy
static method:
Declaration:
.destroy( app: string ): void
Example:
const { Loggerage, LoggerageLevel } = require("loggerage");
const logger = new Loggerage("MY-APP");
logger.debug("Hello world!");
Loggerage.destroy("MY-APP"); // <-- destroy logger
// and after
const logger = Loggerage.getLogger("MY-APP");
// logger is null!