1.0.2 • Published 5 years ago

cd-shared v1.0.2

Weekly downloads
4
License
ISC
Repository
github
Last release
5 years ago

Build Status Coverage Status

Curly Designer Shared Library

This library contains shared modules for Curly Designer projects.

Installation

npm install cd-shared --save

Modules

Logger

This class is responsible for application logging

  • Initialization: this code should be somwhere in beginning of your application.
Logger.appName = 'application name';
Logger.appVersion = '1.0.0';
Logger.level = Logger.Level.INFO;
  • Creating logger instance
export class MyClass {
    logger = new Logger('MyClass');

    constructor() {
        this.logger.debug('Init');
    }
}
  • Logging to database
...
Logger.onLog.subscribe(this.handleLogMessage.bind(this));
...
handleLogMessage(log: Logger.Log): void {
    // add code that writes to database
}

Test

npm run test