<p align="center"> <img alt="LogSemTS Logo" height="300" src="assets/logo.png" /> </p>
npm package | Library Documentation
A modular, color-coded, TypeScript-based semantic logger that can be used in NodeJS, the browser and in many other scenarios.
// Import the logger:
import Logger, { BrowserLogger } from '@fliegwerk/logsemts';
// Create a new logger
const logger = new Logger({
loggers: [BrowserLogger()] // that exclusively outputs to the browser dev tools
});
// get a new subsystem logger for the API Client
const apiClientLogger = logger.getComponentLogger('API Client');
// log a success message
apiClientLogger.success('Data fetched successfully');
$ npm install @fliegwerk/logsemts
or
$ yarn add @fliegwerk/logsemts
There are three primary components in logsemts:
.log()
, .debug()
, .warn()
, etc. to log messages regarding this subsystem.Logger
class. Usually, only one instance of that class gets used in an
application. It manages the different components (Component Loggers get created using the
logger.getComponentLogger(name)
function) and Log Functions. It also forwards the messages from the Component
Loggers to the registered Log Functions.