日志
为什么,什么以及我们如何记录
描述
npm
CLI 具有多种机制,可针对某些命令、配置和环境向最终用户显示不同级别的信息。
设置日志文件位置
所有日志都写入调试日志,如果命令执行失败,则打印该文件的路径。
日志目录的默认位置是 npm 缓存中名为 _logs
的目录。这可以通过 logs-dir
配置选项进行更改。
例如,如果您想将所有日志写入当前工作目录,您可以运行:npm install --logs-dir=.
。这对于调试特定的 npm
问题特别有用,因为您可以使用不同的配置值多次运行命令,然后比较所有日志文件。
MR84p7E5LgI+f0UhrRTpMtHzi9vylbLoLMGbNd6ypcPo7PDD0+Ye4i715SUO6yXIN5/wzvxZ3vfj2bN8QAtYYql2Xh+1rrNmbtz4wKLppTE8fgwwLeWEJet5we2BIE7tYUOiltQMeP09rUqCIT9jP/sgHHlujGBdsfc4jmqvlgcUtYzK/mezk+O/k+e5sslS
RGvLK49w9pWrhj9HGeSy5p2P+hlVu9uX6B2pyslrs32H/ByROLmP9myN4xor5GreWkwq+tLh8/2H6OMFbCWddg==
设置日志级别
loglevel
b54eMv6tvkXKuGqTW0r2uRIddagI8K1OkN4bcAdSfwx9XgZpTzgj4HbtcNYFRV+IdqTEd8lmMnoiECc9c522RP622+fzcp8UjRHd+SlciTNf60/tWxVd99NcDTh/Tu2a2iNo8fXyseyIUeHfFxy6CQ==
b54eMv6tvkXKuGqTW0r2uVqQ4kifDB/Phwdd56zbH0KTJw/aE1ebucavOK/0iGz6Urn3qGj8Ihi7uehlpajNBXfyW9L8IpJS5zphbpylvkFtrq7Q0n4SnQfARoxoR3yCJ6fezNVdBgtygrMCty6XgeuECWOphgdKIE/Yh+Qnhr4=
- p3ESPHSnU1HAiRXs8fzsmIOTReujcFYngzM5UmuxoERLUur2B6EqCH2NwI4GKInPRRs8xYXDoDB5NirGaj70Sqb94PWHIOGp1gKe1RS1V4PLXop+6YQwJ+7xYd48tPfi905mZ3eCTkhyuGSPIbF6FKYxnSOkgPNxJyNuZUZ1M0EGNt6ZIlB9dfNwYnY78WyfOslMYQ4p01/mm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qd5FesGAIhB/nNqPQfmMyIgjWoDu4nqTQibUCimybcdL22J9pmzIwrzYukyF4Y2OvS3MnCNk3//H/ZHFm60Bvko93xHa2WNYvArOmfMHs8k5wXE2KGfWkoVwi+hRBiNmtwISv0L+kUtsuuGJvSEuUWmArJHz7M2R57GQ8DRZd2u+slHjPrIMx0yh/oKUG19L/Wh7FzZpHPe9RQce8dAp8Fm6fZG4HAJeP/0TYU3KwMGMYdPUe62gqjLx1a/UuMwoPZ2Mo4r84rO9EYnBtzgSQWRW50SSoLdSj5FttVC+uOSgSC6VZrXtqK8PAMNSgmh8Eivz2irGtUVHJn3NGPvLZSA+7xkuJHVSwPFEE1A2QZFd0okw0K+7Flui061fvoZemh6EAusgyIYRv1muqU8tYR5adgVD48HhdhAn22H9p7T+RUZiPQ2JFPdFynKH0WzNTK/MN7FjC5H1IPEPLpmGjkSWDYm4CTGY4tJwo5JtPfYX7+OnnWZ17zTjq8pkolr0sh4I7LgjzK+gXOUs=
时间信息
M/UqVdlWmVtTNJ6Cmy84JiFwet8BE+0r5IFuQSqRKZMq09jN8LwHshCY0L+EyowRE2aWwD83jsrPjHy+v6UoN65R9sGQ27mOWe17YypbFHkwWvkC6gxrfNTj1wCZZmfDdGiGMlPrtCo5BZFKG9btmd18bWQ6AO5YAanZo1puH2Q=
- 无论命令退出状态如何,始终显示调试日志的完整路径
- 将时序信息写入缓存或
logs-dir
中的进程特定时序文件 - 向终端输出时序信息
PWwoVW1vGYQQrE5mWlSR2/3Ry8oBu9ZwK/c3LYnJr5TDPyn34NwzOZt7imhLxsSij7vaoMW+pxwS1uy9LMuXC+AGicxAwsESjqv0cjHhghtEnmSbcuj6JyBGlMNSnfH12W4CCWO8To+TkKi8nUkU5ZT5OesSvdUGFLwHAwMwJp3teYkaYpue33TmQj6wgiV8
bCUoZLiRmOi648yaNTh5obrBnax7X0xN/KgE5LF4Oh8nX09ReK6bpH+WHRsER+dC6ukZAdSMT8T0iNCLX57VJ/7hyoApv3EOGtg4hm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