Alternatives to macro substitution in java -
i have log statement in use this.getclass().getsimplename()
as 1st parameter. put in sort of macro constant , use in log statements. learned java has no such simple mechanism unlike c++.
what best way achieve sort of functionality in java?
my example log statements (from android) follows..
log.v(this.getclass().getsimplename(),"starting lociden service...");
java doesn't have macros can make code shorter:
log.v(this, "starting lociden service...");
and in log
class:
public void v(object object, string s) { _v(object.getclass().getsimplename(), s); }
another approach inspect call stack.
Comments
Post a Comment