loopback4-logging
Installation
Install Loopback4LoggingComponent using npm
;
$ [npm install | yarn add] loopback4-logging
Basic Use
Configure and load Loopback4LoggingComponent in the application constructor as shown below.
import {Loopback4LoggingComponent, Loopback4LoggingComponentOptions, DEFAULT_LOOPBACK4_LOGGING_OPTIONS} from 'loopback4-logging';
// ...
export class MyApplication extends BootMixin(ServiceMixin(RepositoryMixin(RestApplication))) {
constructor(options: ApplicationConfig = {}) {
const opts: Loopback4LoggingComponentOptions = DEFAULT_LOOPBACK4_LOGGING_OPTIONS;
this.configure(Loopback4LoggingComponentBindings.COMPONENT).to(opts);
// Put the configuration options here
});
this.component(Loopback4LoggingComponent);
// ...
}
// ...
}
参考文档
item | description |
---|---|
loopback4 component | https://loopback.io/doc/en/lb4/Component.html |
logging component | https://github.com/loopbackio/loopback-next/tree/master/extensions/logging |
logging component generator ??? | https://loopback.io/doc/en/lb4/Extension-generator.html |
组件的用法 lb3 vs lb4 | https://loopback.io/doc/en/lb4/LB3-vs-LB4-request-response-cycle.html |