Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorDarcy Clarke <darcy@darcyclarke.me>2021-12-02 23:36:32 +0300
committerLuke Karrys <luke@lukekarrys.com>2021-12-03 00:31:36 +0300
commit31b098ee26ed17facb132278bb3205e80e2a760d (patch)
treef68e643fce8144b6cd97312557ce3481127f3e97 /docs
parent5e6aea7ae91555313edaf0903b8e1f23ac528260 (diff)
docs: add logging docs
PR-URL: https://github.com/npm/cli/pull/4113 Credit: @darcyclarke Close: #4113 Reviewed-by: @lukekarrys
Diffstat (limited to 'docs')
-rw-r--r--docs/content/using-npm/logging.md60
-rw-r--r--docs/nav.yml3
2 files changed, 63 insertions, 0 deletions
diff --git a/docs/content/using-npm/logging.md b/docs/content/using-npm/logging.md
new file mode 100644
index 000000000..b7c5e8997
--- /dev/null
+++ b/docs/content/using-npm/logging.md
@@ -0,0 +1,60 @@
+---
+title: Logging
+section: 7
+description: Why, What & How we Log
+---
+
+### Description
+
+The `npm` CLI has various mechanisms for showing different levels of information back to end-users for certain commands, configurations & environments.
+
+### Setting Log Levels
+
+#### `loglevel`
+
+`loglevel` is a global argument/config that can be set to determine the type of information to be displayed.
+
+The default value of `loglevel` is `"notice"` but there are several levels/types of logs available, including:
+
+- `"silent"`
+- `"error"`
+- `"warn"`
+- `"notice"`
+- `"http"`
+- `"timing"`
+- `"info"`
+- `"verbose"`
+- `"silly"`
+
+All logs pertaining to a level proceeding the current setting will be shown.
+
+All logs are written to a debug log, with the path to that file printed if the execution of a command fails.
+
+##### Aliases
+
+The log levels listed above have various corresponding aliases, including:
+
+- `-d`: `--loglevel info`
+- `--dd`: `--loglevel verbose`
+- `--verbose`: `--loglevel verbose`
+- `--ddd`: `--loglevel silly`
+- `-q`: `--loglevel warn`
+- `--quiet`: `--loglevel warn`
+- `-s`: `--loglevel silent`
+- `--silent`: `--loglevel silent`
+
+#### `foreground-scripts`
+
+The `npm` CLI began hiding the output of lifecycle scripts for `npm install` as of `v7`. Notably, this means you will not see logs/output from packages that may be using "install scripts" to display information back to you or from your own project's scripts defined in `package.json`. If you'd like to change this behavior & log this output you can set `foreground-scripts` to `true`.
+
+### Registry Response Headers
+
+#### `npm-notice`
+
+The `npm` CLI reads from & logs any `npm-notice` headers that are returned from the configured registry. This mechanism can be used by third-party registries to provide useful information when network-dependent requests occur.
+
+This header is not cached, and will not be logged if the request is served from the cache.
+
+### See also
+
+* [config](/using-npm/config)
diff --git a/docs/nav.yml b/docs/nav.yml
index a45aefbb0..a82847fc3 100644
--- a/docs/nav.yml
+++ b/docs/nav.yml
@@ -235,6 +235,9 @@
- title: Config
url: /using-npm/config
description: About npm configuration
+ - title: Logging
+ url: /using-npm/logging
+ description: Why, What & How we Log
- title: Scope
url: /using-npm/scope
description: Scoped packages