{"action":"created","issue":{"url":"https://api.github.com/repos/Homegear/Homegear/issues/194","labels_url":"https://api.github.com/repos/Homegear/Homegear/issues/194/labels{/name}","comments_url":"https://api.github.com/repos/Homegear/Homegear/issues/194/comments","events_url":"https://api.github.com/repos/Homegear/Homegear/issues/194/events","html_url":"https://github.com/Homegear/Homegear/issues/194","id":70392606,"number":194,"title":"enhanced script logging ","user":{"login":"spali","id":1839708,"avatar_url":"https://avatars.githubusercontent.com/u/1839708?v=3","gravatar_id":"","url":"https://api.github.com/users/spali","html_url":"https://github.com/spali","followers_url":"https://api.github.com/users/spali/followers","following_url":"https://api.github.com/users/spali/following{/other_user}","gists_url":"https://api.github.com/users/spali/gists{/gist_id}","starred_url":"https://api.github.com/users/spali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spali/subscriptions","organizations_url":"https://api.github.com/users/spali/orgs","repos_url":"https://api.github.com/users/spali/repos","events_url":"https://api.github.com/users/spali/events{/privacy}","received_events_url":"https://api.github.com/users/spali/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Homegear/Homegear/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"hfedcba","id":1392015,"avatar_url":"https://avatars.githubusercontent.com/u/1392015?v=3","gravatar_id":"","url":"https://api.github.com/users/hfedcba","html_url":"https://github.com/hfedcba","followers_url":"https://api.github.com/users/hfedcba/followers","following_url":"https://api.github.com/users/hfedcba/following{/other_user}","gists_url":"https://api.github.com/users/hfedcba/gists{/gist_id}","starred_url":"https://api.github.com/users/hfedcba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hfedcba/subscriptions","organizations_url":"https://api.github.com/users/hfedcba/orgs","repos_url":"https://api.github.com/users/hfedcba/repos","events_url":"https://api.github.com/users/hfedcba/events{/privacy}","received_events_url":"https://api.github.com/users/hfedcba/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/Homegear/Homegear/milestones/2","html_url":"https://github.com/Homegear/Homegear/milestones/0.6","labels_url":"https://api.github.com/repos/Homegear/Homegear/milestones/2/labels","id":653955,"number":2,"title":"0.6","description":null,"creator":{"login":"hfedcba","id":1392015,"avatar_url":"https://avatars.githubusercontent.com/u/1392015?v=3","gravatar_id":"","url":"https://api.github.com/users/hfedcba","html_url":"https://github.com/hfedcba","followers_url":"https://api.github.com/users/hfedcba/followers","following_url":"https://api.github.com/users/hfedcba/following{/other_user}","gists_url":"https://api.github.com/users/hfedcba/gists{/gist_id}","starred_url":"https://api.github.com/users/hfedcba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hfedcba/subscriptions","organizations_url":"https://api.github.com/users/hfedcba/orgs","repos_url":"https://api.github.com/users/hfedcba/repos","events_url":"https://api.github.com/users/hfedcba/events{/privacy}","received_events_url":"https://api.github.com/users/hfedcba/received_events","type":"User","site_admin":false},"open_issues":38,"closed_issues":26,"state":"open","created_at":"2014-05-09T10:09:51Z","updated_at":"2015-11-12T10:22:11Z","due_on":null,"closed_at":null},"comments":4,"created_at":"2015-04-23T11:51:57Z","updated_at":"2015-11-12T10:48:40Z","closed_at":null,"body":"before version 0.6, script output was displayed in the Homegear log which helped debugging of just scripts. It seems there changed something in version 0.6.\r\nI know, there is (my requested) ```writeLog``` rpc method. But calling it does result in around the double time of script execution when using it a few times in the script. \r\nThis have to be the overhead of the rpc calls. Maybe there must be a better way to archive both.\r\n\r\nWhat do you think about output script output always plain in the log like previous behavior.\r\nThis would allow the script to handle how much should be logged.\r\n\r\nI see the following advantages:\r\n- script can still decide how much will be logged\r\n- script can still decide based on the log level received by a single call to ```logLevel```\r\n- script has still the possibility to send logs with ```writeLog``` to Homegear. This can be done based on the current log level which makes it more efficient except script want it to send to Homegear.\r\n\r\nIn general, I would then implements scripts as follows:\r\nScript gets the current log level at the beginning and only sends logs based on this log level to Homegear. But the script allows local debugging by just output text, without increasing the debug level of Homegear (which would result in to much information when just the script output is required for script debugging). \r\nTheoretical there would also be the possibility to get STDERR output of the script on debuglevel >= 1 or maybe 2= and STDOUT only on debuglevel >= 4\r\n\r\nAdditional to this general suggestion, when using ```writeLog``` by rpc calls, at a higher log level (dont know if 4 or 5), the text is displayed twice. Once the real log line as requested by rpc call to ```writeLog``` but also again because the rpc call itself is logged.\r\n```\r\n04/24/15 11:19:48.459 my message\r\n(String) my message\r\n```\r\nMaybe in this special case, it could make sense to hide rpc call logging itself?\r\n\r\n\r\n\r\n**In Short :)**\r\nDepending on what you prefer, I would wish the following concrete changes:\r\n- Log Script Output of STDOUT to the logfile if homegear debuglevel >= 4\r\n- Log Scipt STDERR Output to the logfile if homegear debuglevel >= 2  (1 should maybe be reserved for homegear errors)\r\n- For the special case of RPC Method call ```writeLog``` do only print the text of the parameter and not the debug stuff of ```writeLog``` itself.\r\n\r\n**Ferrari solution**\r\nThe above is the easier implementation, because it I could imagine also to solve this by introducing different log levels for different components. I.e. have a debug level for scripts, having a debuglevel for device communication, having a debuglevel for Homegear core stuff etc....\r\nThe cool thing here is, it makes specific debugging possible, but of course would require almost a complete new logging functionality based on the Homegear components.\r\nMaybe this is something for 0.7 ;) and first just the simple implementation.\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/Homegear/Homegear/issues/comments/156070283","html_url":"https://github.com/Homegear/Homegear/issues/194#issuecomment-156070283","issue_url":"https://api.github.com/repos/Homegear/Homegear/issues/194","id":156070283,"user":{"login":"hfedcba","id":1392015,"avatar_url":"https://avatars.githubusercontent.com/u/1392015?v=3","gravatar_id":"","url":"https://api.github.com/users/hfedcba","html_url":"https://github.com/hfedcba","followers_url":"https://api.github.com/users/hfedcba/followers","following_url":"https://api.github.com/users/hfedcba/following{/other_user}","gists_url":"https://api.github.com/users/hfedcba/gists{/gist_id}","starred_url":"https://api.github.com/users/hfedcba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hfedcba/subscriptions","organizations_url":"https://api.github.com/users/hfedcba/orgs","repos_url":"https://api.github.com/users/hfedcba/repos","events_url":"https://api.github.com/users/hfedcba/events{/privacy}","received_events_url":"https://api.github.com/users/hfedcba/received_events","type":"User","site_admin":false},"created_at":"2015-11-12T10:48:40Z","updated_at":"2015-11-12T10:48:40Z","body":"\\Homegear\\Homegear::log() now exists ;). Still missing is the component seperation."}}