The `npm` CLI has various mechanisms for showing different levels of information back to end-users for certain commands, configurations & environments.
The default location of the logs directory is a directory named `_logs` inside the npm cache. This can be changed with the `logs-dir` config option.
For example, if you wanted to write all your logs to the current working directory, you could run: `npm install --logs-dir=.`. This is especially helpful in debugging a specific `npm` issue as you can run
a command multiple times with different config values and then diff all the log files.
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`.
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.
The `npm` CLI makes a best effort to redact the following from terminal output and log files:
- Passwords inside basic auth URLs
- npm tokens
However, this behavior should not be relied on to keep all possible sensitive information redacted. If you are concerned about secrets in your log file or terminal output, you can use `--loglevel=silent` and `--logs-max=0` to ensure no logs are written to your terminal or filesystem.