@jsenv/logger
Advanced tools
Comparing version 3.2.0 to 3.3.0
{ | ||
"name": "@jsenv/logger", | ||
"version": "3.3.0", | ||
"description": "Control verbosity of logs during a function execution.", | ||
"version": "3.2.0", | ||
"license": "MIT", | ||
@@ -14,2 +14,4 @@ "repository": { | ||
}, | ||
"type": "module", | ||
"exports": "./index.js", | ||
"module": "index.js", | ||
@@ -24,22 +26,28 @@ "files": [ | ||
"eslint-check": "eslint .", | ||
"prettier-check": "node ./script/prettier-check/prettier-check.js", | ||
"prettier-format": "node ./script/prettier-format/prettier-format.js", | ||
"prettier-format-stage": "npm run prettier-format -- --staged", | ||
"prettier-check": "npm run prettier-format -- --dry-run", | ||
"upload-coverage": "node ./script/upload-coverage/upload-coverage.js", | ||
"generate-import-map": "node ./script/generate-import-map/generate-import-map.js", | ||
"clean": "rimraf dist && rimraf coverage", | ||
"install-git-hooks": "node ./script/install-git-hooks/install-git-hooks.js", | ||
"clean": "rimraf coverage", | ||
"reinstall": "npm run clean && rimraf node_modules && npm install", | ||
"prepublishOnly": "node ./script/transform-package/remove-postinstall.js", | ||
"postpublish": "node ./script/transform-package/restore-postinstall.js" | ||
"postpublish": "node ./script/transform-package/restore-postinstall.js", | ||
"git-hook-pre-commit": "npm run prettier-format-stage" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"@jsenv/assert": "1.1.1", | ||
"@jsenv/codecov-upload": "3.0.0", | ||
"@jsenv/core": "10.3.3", | ||
"@jsenv/eslint-config": "12.0.0", | ||
"@jsenv/assert": "1.2.1", | ||
"@jsenv/codecov-upload": "3.1.0", | ||
"@jsenv/core": "10.5.0", | ||
"@jsenv/eslint-config": "12.1.0", | ||
"@jsenv/git-hooks": "1.2.0", | ||
"@jsenv/github-release-package": "1.1.1", | ||
"@jsenv/node-module-import-map": "9.4.0", | ||
"@jsenv/package-publish": "1.1.0", | ||
"@jsenv/node-module-import-map": "10.0.1", | ||
"@jsenv/package-publish": "1.2.0", | ||
"@jsenv/prettier-check-project": "5.1.1", | ||
"@jsenv/prettier-config": "1.1.0", | ||
"@jsenv/prettier-check-project": "4.2.0", | ||
"babel-eslint": "11.0.0-beta.0", | ||
"eslint": "6.7.2", | ||
"eslint": "6.8.0", | ||
"prettier": "1.19.1", | ||
@@ -46,0 +54,0 @@ "rimraf": "3.0.0" |
@@ -1,3 +0,5 @@ | ||
# Logger | ||
# logger | ||
Control verbosity of logs during a function execution. | ||
[![github package](https://img.shields.io/github/package-json/v/jsenv/jsenv-logger.svg?logo=github&label=package)](https://github.com/jsenv/jsenv-logger/packages) | ||
@@ -8,8 +10,7 @@ [![npm package](https://img.shields.io/npm/v/@jsenv/logger.svg?logo=npm&label=package)](https://www.npmjs.com/package/@jsenv/logger) | ||
Control verbosity of logs during a function execution. | ||
# Table of contents | ||
## Table of contents | ||
- [Presentation](#Presentation) | ||
- [Usage](#usage) | ||
- [Installation](#installation) | ||
- [Documentation](#usage) | ||
- [createLogger](#createLogger) | ||
@@ -19,5 +20,4 @@ - [logLevel](#logLevel) | ||
- [Migration from console](#migration-from-console) | ||
- [Installation](#installation) | ||
## Presentation | ||
# Presentation | ||
@@ -28,12 +28,16 @@ You want to use `@jsenv/logger` when you have many logs with different purposes and controls which type of logs are actually written. | ||
## Usage | ||
# Installation | ||
This documentation explains how to use `@jsenv/logger` in your codebase. | ||
Before installing, please note that you cannot directly `require` this package because there is no commonjs version for the source code. | ||
### createLogger | ||
```console | ||
npm install @jsenv/logger@3.3.0 | ||
``` | ||
> `createLogger` is a function receiving a `logLevel` and returning a `logger` object. | ||
# Documentation | ||
Implemented in [src/createLogger.js](./src/createLogger.js), you can use it as shown below. | ||
## createLogger | ||
`createLogger` is a function receiving a `logLevel` and returning a `logger` object. | ||
```js | ||
@@ -59,5 +63,7 @@ import { createLogger } from "@jsenv/logger" | ||
— source code at [src/createLogger.js](./src/createLogger.js). | ||
### logLevel | ||
> `logLevel` parameter is a string controlling verbosity of the returned `logger`. | ||
`logLevel` parameter is a string controlling verbosity of the returned `logger`. | ||
@@ -80,6 +86,5 @@ The possible logLevel values are: | ||
### logger | ||
## logger | ||
> `logger` is an object with methods logging a message with a given level. | ||
`logger` is an object with methods logging a message with a given level.<br /> | ||
It is returned by `createLogger`, and has the following shape: `{ debug, info, warn, error }`. Each method calls the corresponding console method or do nothing depending on the `logLevel`. | ||
@@ -105,3 +110,3 @@ | ||
### Migration from console | ||
## Migration from console | ||
@@ -117,17 +122,1 @@ Using `@jsenv/logger` means converting console methods into logger methods. `console.info` becomes `logger.info` and so on. | ||
It means you have to convert `console.log` into `logger.debug` or `logger.info`. | ||
## Installation | ||
Before installing, please note that you cannot directly `require` this package because there is no commonjs version for the source code. | ||
If you never installed a jsenv package, read [Installing a jsenv package](https://github.com/jsenv/jsenv-core/blob/master/docs/installing-jsenv-package.md#installing-a-jsenv-package) before going further. | ||
This documentation is up-to-date with a specific version so prefer any of the following commands | ||
```console | ||
npm install @jsenv/logger@3.2.0 | ||
``` | ||
```console | ||
yarn add @jsenv/logger@3.2.0 | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Yes
8708
14
116