@the-hw-app/logger
Version:
A logger made for internal use by The Homework App.
105 lines (69 loc) • 2.27 kB
Markdown
# @the-hw-app/logger
## Installation
### Yarn (Recommended)
```
$ yarn add @the-hw-app/logger
```
### NPM
```
$ npm install @the-hw-app/logger
```
## Scripts
### Test
`test` will run the tests.
```bash
yarn test
```
### Prepare
`prepare` will run both BEFORE the package is packed and published, and on local npm install. Perfect for running building the code.
```bash
yarn prepare
```
### PrepublishOnly
`prepublishOnly` will run BEFORE **prepare** and ONLY on **npm publish**. Here we will run our test and lint to make sure we don’t publish bad code
```bash
yarn prepublishOnly
```
### Preversion
`preversion` will run before bumping a new package version. To be extra sure that we’re not bumping a version with bad code
```bash
yarn preversion
```
### Version
`version` will run after a new version has been bumped. If your package has a git repository, like in our case, a commit and a new version-tag will be made every time you bump a new version. This command will run BEFORE the commit is made. One idea is to run the formatter here and so no ugly code will pass into the new version
```bash
yarn version
```
### Postversion
`postversion` will run after the commit has been made. A perfect place for pushing the commit as well as the tag.
```bash
yarn postversion
```
## Usage
### Build
```
$ yarn build
```
*Note: If you want to build on change (watch mode) use `yarn build -w`*
### Experiment
The best way to experiment is by writing testing testing cases and running them.
### Test
```
$ yarn test
```
or
```
$ yarn test [file_name]
```
## Log Levels
| Code | Severity | Description |
| ---- |-------------- | -------------------------------- |
| 0 | Emergency | system is unusable |
| 1 | Alert | action must be taken immediately |
| 2 | Critical | critical conditions |
| 3 | Error | error conditions |
| 4 | Warning | warning conditions |
| 5 | Notice | normal but significant condition |
| 6 | Informational | informational messages |
| 7 | Debug | debug-level messages |
As stated in [RFC 5424](https://datatracker.ietf.org/doc/html/rfc5424).