<a href="https://travis-ci.org/hapinessjs/logger-module.svg?branch=master">
<img src="https://travis-ci.org/hapinessjs/logger-module.svg?branch=master" alt="build" />
</a>
<a href="https://coveralls.io/github/hapinessjs/logger-module?branch=master">
<img src="https://coveralls.io/repos/github/hapinessjs/logger-module/badge.svg?branch=master" alt="coveralls" />
</a>
<a href="https://david-dm.org/hapinessjs/logger-module">
<img src="https://david-dm.org/hapinessjs/logger-module.svg" alt="dependencies" />
</a>
<a href="https://david-dm.org/hapinessjs/logger-module?type=dev">
<img src="https://david-dm.org/hapinessjs/logger-module/dev-status.svg" alt="devDependencies" />
</a>
<a href="https://www.typescriptlang.org/docs/tutorial.html">
<img src="https://cdn-images-1.medium.com/max/800/1*8lKzkDJVWuVbqumysxMRYw.png"
align="right" alt="Typescript logo" width="50" height="50" style="border:none;" />
</a>
<a href="http://reactivex.io/rxjs">
<img src="http://reactivex.io/assets/Rx_Logo_S.png"
align="right" alt="ReactiveX logo" width="50" height="50" style="border:none;" />
</a>
<a href="http://hapijs.com">
<img src="http://bit.ly/2lYPYPw"
align="right" alt="Hapijs logo" width="75" style="border:none;" />
</a>
Logger Module
Logger
module for the Hapiness framework.Table of contents
* [Yarn or NPM it in your package.json](#yarn-or-npm-it-in-your-packagejson)
* [Import LoggerModule from the library](#import-loggermodule-from-the-library)
Using your module inside Hapiness application
yarn
or npm
it in your package.json
$ npm install --save @hapiness/core @hapiness/logger rxjs
or
$ yarn add @hapiness/core @hapiness/logger rxjs
"dependencies": {
"@hapiness/core": "^1.2.2",
"@hapiness/logger": "^1.1.0",
"rxjs": "^5.5.2",
//...
}
//...
import LoggerModule
from the library
import { Hapiness, HapinessModule, HttpServer, OnGet } from '@hapiness/core';
import { LoggerModule, LoggerService } from '@hapiness/logger';
@HapinessModule({
version: '1.0.0',
imports: [
LoggerModule
]
})
class HapinessModuleApp {
constructor(private _logger: LoggerService) {
this._logger.info('my data log');
}
}
@Route({
method: 'get',
path: '/test'
})
class MyRoute implements OnGet {
constructor(private _logger: LoggerService) {}
onGet(request, reply) {
this._logger.warn('my data log');
reply('test');
}
}
// Define your logger
Hapiness.bootstrap(HapinessModuleApp, [ LoggerExt.setConfig({ logger: myLogger }) ]);
Access logs
If HttpServerExt is loaded, the LoggerModule will inject an AccessLogs component. To desactivate the access logs, provide a module's config:@HapinessModule({
version: '1.0.0',
imports: [
LoggerModule.setConfig({ accessLogs: false })
]
})
class HapinessModuleApp {
...
}
Back to top
Contributing
To set up your development environment:- clone the repo to your workspace,
- in the shell
cd
to the main folder, - hit
npm or yarn install
, - run
npm or yarn run test
.
* It will lint the code and execute all tests.
* The test coverage report can be viewed from `./coverage/lcov-report/index.html`.
Back to topChange History
- v1.1.0 (2017-11-20)
* Latest packages' versions.
* Documentation.
* Change packaging process.
- v1.0.0 (2017-10-26)
* Create LoggerModule
* Logger extension
* Logger provider
* Access logs
* Documentation
Back to topMaintainers
Back to top
License
Copyright (c) 2017 Hapiness Licensed under the MIT license.Back to top