I have a question on logging. The doc states that "most of the time you should just use Pod.of(this).log.err("...")". And if you don't want to write Pod.of(this).log every time, than you can do "const static Log log = Log.get(name)". Which still is a bit awkward since "name" can not be derived from the class name, like MyApp.class.name and needs to be manually changed in case the class name changes (refactor). "const static Log log = Pod.of(this).log" does not work in a static context because "this" is not available. I'm using logging quite a bit and would like it to be as simple as possible. Something like "const static Log log = Log.get" (or Log.log) with a name similar to "Pod:class/mixin" would be really nice. Any idea how to achieve it?
brianSun 17 Apr 2011
Hi jdonnerstag,
There currently isn't a way to get the type or pod of the containing class. Although we have discussed it before, for example using something like #. I think we'll eventually do something there in the future. In the meantime, one thing I do a lot just a simple work around for static logs is:
class Foo
{
const static Log log := Foo#.pod.log
}
jdonnerstag Sun 17 Apr 2011
I have a question on logging. The doc states that "most of the time you should just use Pod.of(this).log.err("...")". And if you don't want to write Pod.of(this).log every time, than you can do "const static Log log = Log.get(name)". Which still is a bit awkward since "name" can not be derived from the class name, like MyApp.class.name and needs to be manually changed in case the class name changes (refactor). "const static Log log = Pod.of(this).log" does not work in a static context because "this" is not available. I'm using logging quite a bit and would like it to be as simple as possible. Something like "const static Log log = Log.get" (or Log.log) with a name similar to "Pod:class/mixin" would be really nice. Any idea how to achieve it?
brian Sun 17 Apr 2011
Hi jdonnerstag,
There currently isn't a way to get the type or pod of the containing class. Although we have discussed it before, for example using something like
#
. I think we'll eventually do something there in the future. In the meantime, one thing I do a lot just a simple work around for static logs is: