日志
为什么,什么以及我们如何记录
描述
npm
CLI 具有多种机制,可针对某些命令、配置和环境向最终用户显示不同级别的信息。
设置日志文件位置
所有日志都写入调试日志,如果命令执行失败,则打印该文件的路径。
日志目录的默认位置是 npm 缓存中名为 _logs
的目录。这可以通过 logs-dir
配置选项进行更改。
当日志文件数量超过 logs-max
时,日志文件将从 logs-dir
中删除,最旧的日志首先被删除。
RGvLK49w9pWrhj9HGeSy5p2P+hlVu9uX6B2pyslrs32H/ByROLmP9myN4xor5GreWkwq+tLh8/2H6OMFbCWddg==
设置日志级别
loglevel
b54eMv6tvkXKuGqTW0r2uRIddagI8K1OkN4bcAdSfwx9XgZpTzgj4HbtcNYFRV+IdqTEd8lmMnoiECc9c522RP622+fzcp8UjRHd+SlciTNf60/tWxVd99NcDTh/Tu2a2iNo8fXyseyIUeHfFxy6CQ==
b54eMv6tvkXKuGqTW0r2uVqQ4kifDB/Phwdd56zbH0KTJw/aE1ebucavOK/0iGz6Urn3qGj8Ihi7uehlpajNBXfyW9L8IpJS5zphbpylvkFtrq7Q0n4SnQfARoxoR3yCJ6fezNVdBgtygrMCty6XgeuECWOphgdKIE/Yh+Qnhr4=
- p3ESPHSnU1HAiRXs8fzsmIOTReujcFYngzM5UmuxoERLUur2B6EqCH2NwI4GKInPRRs8xYXDoDB5NirGaj70Sqb94PWHIOGp1gKe1RS1V4PLXop+6YQwJ+7xYd48tPfi905mZ3eCTkhyuGSPIbF6FKYxnSOkgPNxJyNuZUZ1M0EGNt6ZIlB9dfNwYnY78WyfOslMYQ4p01/mmaBKRD+LCbHqUQqWzJa31vTotiFXxiKWE/WLHxH/nKf12NGGc0JqQxEiOCESd3/nEcC1T5fdR5D3S+u/P7t5ZniGetJS9kfwC4ZHe2poiZa3YmV4m9XFFHqeSkXjiiJgwX+UxReGgdqMJvVIGUoX/a0N/fm7vimVHgF19iRFblmA5qKwUbD2
x6Pmg4KmKUd9bA1938c1M0JAofdf9Ljmiqex8yr2pNhswkoSR3CF4G3LnDa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Qce8dAp8Fm6fZG4HAJeP/0TYU3KwMGMYdPUe62gqjLx1a/UuMwoPZ2Mo4r84rO9EYnBtzgSQWRW50SSoLdSj5FttVC+uOSgSC6VZrXtqK8PAMNSgmh8Eivz2irGtUVHJn3NGPvLZSA+7xkuJHVSwPFEE1A2QZFd0okw0K+7Flui061fvoZemh6EAusgyIYRv1muqU8tYR5adgVD48HhdhAn22H9p7T+RUZiPQ2JFPdFynKH0WzNTK/MN7FjC5H1IPEPLpmGjkSWDYm4CTGY4tJwo5JtPfYX7+OnnWZ17zTjq8pkolr0sh4I7LgjzK+gXOUs=
时间信息
HZcMSOC0qY3Uj/gUTcEcARccK15VFKVAY3e64PFlfvqx2sgBD3xJV9it6He4EMzaV/Xg2q0CtGTo6tDnLWZXRw==
- 无论命令退出状态如何,始终显示调试日志的完整路径
- 将时序信息写入缓存或
logs-dir
中的时序文件
yJJjhnJbm4oCK0GrWo0a01r/ikVUnN1PxYNczyy0KsyqSitcBvoqbUl6975ysC8a2M6oNvqeazzMO8JTkHO8grwozJInKvp7ROtWJrXoSqp8LoIypRtjpsgZQioq9iSoxsX5L+dJLvrRCdM4QyVf/JqAI8p3XDVuWKkTuQchLDLgOByy4nzpZcutAPvSMg8sSxKII9ltvqjcWkFV8lZwbg==
注册表响应标头
npm-notice
WhnL6zK65sv11OaVs2E4ypEwWVjWCHawA0ASmYqCHLcQ0sn0LWnN5HUO6k5RxwqXnNuh2UWkvFBiDyTqs1sqTIWqGRS+ht6BCOsk1nzVY6Lr7vP69eSwuFBUJxsZNA7CaYIpEnQmqDHK8YxHRRNWReeF7WgdTNK1sOgkG2bULr39GFORff1B0uwSgejXLyIHGqaaxFA3AG3l79YUhoWIMq7MSDyw9hZk3eCPefa9hf9grUxOw/XyecYEzh6ZegsyavPUvrsJ+PLGLloxwPRSBA==
A0sPv1077MDHqO91L3qTkF3HHP3ihbDzyx4qnWAsdjf9/BGN8eOA9RiuSQ8+tRsRa86idzInehJ8ZS3N9uqmleHJljTuF93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