@happ/nest-logger
v21.0.1
Published
> Beta. Don't use it in production (yet).
Downloads
28
Keywords
Readme
@happ/nest-logger
Beta. Don't use it in production (yet).
Description
Simple in setup and flexible in usage logger with full path logs
Installation
yarn add @happ/nest-logger
Register
import { LoggerModule } from "@happ/nest-logger";
@Module({
imports: [
LoggerModule,
// Or
LoggerModule.register({
debug: false,
disableArguments: false,
disable: false,
disableLog: false,
disableDebug: false,
disableWarn: false,
disableError: false,
disableInfo: false,
})
]
})
export class AppModule {}
Providers
Logs automatically available in each provider.
Controllers
To enable logs for controller, you have to add @Logger
decorator under the @Controller
decorator.
import { Logger } from "@happ/nest-logger";
@Controller('users')
@Logger()
export class UsersController {}
Decorators
@Logger(config: Partial<ILoggerConfig>)
- for specific configimport {Logger} from "@happ/nest-logger"; @Injectable() export class UsersService { @Logger({ debug: true }) getMany() {}
@Debug
- shortcut for@Logger({ debug: true })
@Disable
- shortcut for@Logger({ disable: true })
@DisableArguments
- shortcut for@Logger({ disableArguments: true })
import {DisableArguments, Logger} from "@happ/nest-logger"; @Injectable() export class UsersService { @DisableArguments getMany() {}