@itsquarehub/ngx-logger
v0.14.1
Published
An angular library for logging your classes such as service, components, directives, etc... for debugging purposes.
Downloads
3
Readme
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;
}
}