Subscription date : 28 October 2009
Messages : 415
|
Hey,
If it isn't already there, would it not be an idea to have a "logger" script that could be imported and toggled on and off for debugging?
So suppose I develop my applet, instead of using "print 'something went wrong', I would import a CDlogger and I could use CDlogger.log('something went wrong'). If toggled on CD outputs this neatly and consistently in Terminal and all applets happily communicate trough that.
Log output should show something like:
[date, time][core][info][loaded me-mennu applet]
[date, time][me-menu][critical][something's really wrong here!]
etc.
Does it make sense? |
fabounet, Tuesday 16 August 2011 à 16:12
|
|
Subscription date : 30 November 2007
Messages : 17118
|
in C, the macro cd_warning and cie prints the source file, so then you can filter the output with a sed (see the post in Tricks and Hints)
so i suppose you could do this in Python too (print "toto: blabla", and then cairo-dock | sed -n "/toto/p") |
Subscription date : 28 October 2009
Messages : 415
|
I'm not sure we're talking about the same thing here |
fabounet, Wednesday 17 August 2011 à 12:42
|
|
Subscription date : 30 November 2007
Messages : 17118
|
in the C API, you have for instance:
cd_warning ("toto")
--> file:line:warning toto
so I think it's what you wanted?
and then you can filter the output of the dock with a sed
now in Python there is no such function, but I guess you can use a custom print func, or maybe if you want to make a log class, we can integrate it in the Applet class. |
Subscription date : 28 October 2009
Messages : 415
|
I can't read C really, but it looks like it's what I mean.
I mean I can make my own logger class, which I could switch on or off from the configuration. I was just thinking that having a centralised means to print out a log would be more handy. Is that what you mean with "integrate it in the Applet class"? |
fabounet, Wednesday 17 August 2011 à 13:08
|
|
Subscription date : 30 November 2007
Messages : 17118
|
yep, I think Eduardo made such a log class in one of its applet (Translator or Quote maybe), I don't remember well how it was done and how you activate it or not. |
Subscription date : 28 October 2009
Messages : 415
|
OK i will look at his code. |
|