Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hapinessjs/logger-module
Hapiness module to log data inside framework
https://github.com/hapinessjs/logger-module
Last synced: 7 days ago
JSON representation
Hapiness module to log data inside framework
- Host: GitHub
- URL: https://github.com/hapinessjs/logger-module
- Owner: hapinessjs
- License: mit
- Created: 2017-05-24T12:44:15.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-20T13:52:39.000Z (about 7 years ago)
- Last Synced: 2024-12-26T15:36:41.068Z (11 days ago)
- Language: TypeScript
- Homepage:
- Size: 84 KB
- Stars: 0
- Watchers: 7
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Logger Module
`Logger` module for the [Hapiness](https://github.com/hapinessjs/hapiness) framework.
## Table of contents
* [Using your module inside Hapiness application](#using-your-module-inside-hapiness-application)
* [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)
* [Contributing](#contributing)
* [Change History](#change-history)
* [Maintainers](#maintainers)
* [License](#license)## Using your module inside Hapiness application
### `yarn` or `npm` it in your `package.json`
```bash
$ npm install --save @hapiness/core @hapiness/logger rxjsor
$ yarn add @hapiness/core @hapiness/logger rxjs
```
```javascript
"dependencies": {
"@hapiness/core": "^1.2.2",
"@hapiness/logger": "^1.1.0",
"rxjs": "^5.5.2",
//...
}
//...
```### import `LoggerModule` from the library
```javascript
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:
```javascript
@HapinessModule({
version: '1.0.0',
imports: [
LoggerModule.setConfig({ accessLogs: false })
]
})
class HapinessModuleApp {
...
}
```[Back to top](#table-of-contents)
## Contributing
To set up your development environment:
1. clone the repo to your workspace,
2. in the shell `cd` to the main folder,
3. hit `npm or yarn install`,
4. 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 top](#table-of-contents)
## Change 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 top](#table-of-contents)
## Maintainers
Julien Fauville
Antoine Gomez
Sébastien Ritz
Nicolas Jessel
[Back to top](#table-of-contents)
## License
Copyright (c) 2017 **Hapiness** Licensed under the [MIT license](https://github.com/hapinessjs/empty-module/blob/master/LICENSE.md).
[Back to top](#table-of-contents)