Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

打印到console的日志添加时间戳,添加标志位区分development和production #14

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

7ippo
Copy link

@7ippo 7ippo commented Aug 8, 2019

Bonjour,非常感谢这个开源项目,让我学到了很多东西。另外考虑到业务日志在发布后不打印到console这个需求,我加入了flag供区分,只有处于开发环境才会打印到console。此外输出到console的日志很多情况下都需要时间戳以直观发现业务耗时,比如是否在某个流程停留过久的问题。所以在输出到console的时候,我加入了一个简单的时间戳(localTime)供参考。再次感谢您维护这个开源项目,祝生活愉快,Je te souhaite une belle vie.

2019/8/8 下午4:02:18 [test] INFO tag data
2019/8/8 下午4:02:18 [test] INFO tag this is data2
2019/8/8 下午4:02:18 [test] INFO tag data3 is here
2019/8/8 下午4:02:18 [test] INFO tag where is data4

添加标志位区分开发环境和生产环境。
1、只有在开发环境中,日志才会添加local time一起输出到控制台
2、生产环境中,不会输出日志到window.console
有线IndexedDB,localStorage有其他用处可能会存在大小限制
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant