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

0.14.1 • Public • Published

NgxLogger

An angular library for logging your classes such as service, components, directives, etc... for debugging purposes.

Install

npm install @itsquarehub/ngx-logger

or

yarn add @itsquarehub/ngx-logger

Usage

Installation

import { LoggerModule, LoggerConfig } from '@itsquarehub/ngx-logger';

export function loggerConfig(cookieService: CookieService): LoggerConfig {
  let loggerFlag = cookieService.getEncryptedItem('enableLogger');
  return { enableLogging: loggerFlag || false } as LoggerConfig;
}

@NgModule({
  imports: [
    LoggerModule.forRoot(loggerConfig, [CookieService]),
  ]
})

For logging all class methods or properties use the LogClass() decorator.

import { LogClass } from '@itsquarehub/ngx-logger';

@LogClass()
export class MyClass {

  public addNumbers(first: number, second: number): number {
    return first + second;
  }
}

For logging methods or properties use the LogMethod() decorator.

import { LogMethod } from '@itsquarehub/ngx-logger';

export class MyClass {

  @LogMethod()
  public addNumbers(first: number, second: number): number {
    return first + second;
  }
}

If you want to ignore methods in a class logging

import { LogClass, LogIgnore } from '@itsquarehub/ngx-logger';

@LogClass()
export class MyClass {

  @LogIgnore()
  public addNumbers(first: number, second: number): number {
    return first + second;
  }
}

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @itsquarehub/ngx-logger

Weekly Downloads

0

Version

0.14.1

License

none

Unpacked Size

107 kB

Total Files

28

Last publish

Collaborators

  • apascual-ish