简体   繁体   English

从仪表板小部件记录错误

[英]Logging errors from a Dashboard Widget

I recently took over maintenance of a widget for OSX Dashboard. 我最近接手了OSX仪表板小部件的维护。 A user is complaining about a bug which I've been unable to reproduce. 用户抱怨我无法重现的错误。 I've been unable to find any error logs for Dashboard Widgets, although Dashcode displays an informative 'Run Log' containing both exceptions and javascript calls to alert(). 尽管Dashcode显示了一个内容丰富的“运行日志”,其中包含异常和对alert()的javascript调用,但我一直无法找到Dashboard Widgets的任何错误日志。 Is there any way I could send the user a version which would log such information to a file to give me some idea of where the bug lies? 有什么办法可以向用户发送一个版本,该版本会将此类信息记录到文件中,从而使我对错误的位置有所了解?

一种可能是在整个代码中调用如下代码:

widget.system("echo `date` 'My custom log line' >> /tmp/mydashboardwidget.log");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM