@peerlancers/ngx-logger
v1.0.6
Published
An angular library for logging your classes such as service, components, directives, etc... for debugging purposes.
Downloads
11
Readme
NgxLogger
An angular library for logging your classes such as service, components, directives, etc... for debugging purposes.
Install
npm install @peerlancers/ngx-logger
or
yarn add @peerlancers/ngx-logger
Usage
Installation
import { LoggerModule, LoggerConfig } from '@peerlancers/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 '@peerlancers/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 '@peerlancers/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 '@peerlancers/ngx-logger';
@LogClass()
export class MyClass {
@LogIgnore()
public addNumbers(first: number, second: number): number {
return first + second;
}
}