[slf4j-dev] Context for getLogger()
Fred
phreed at gmail.com
Mon Jun 28 22:08:03 CEST 2010
I have been modifying slf4j for use on android.
Beginning with the slf4j-android sub-project, I am adding in
a context provider to record, forward, combine, filter and otherwise
manage the log.
In order to do this getLogger needs to know the current context.
To work around this I have added a context parameter.
e.g.
import android.content.Context;
import android.graphics.Matrix;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Sample implements Cloneable {
private Sample(Context context) {
_log = LoggerFactory.getLogger(Sample.class, context);
...
I can provide more detail if this is not clear.
What I want to know is if this is the best way do deal with the problem?
In order to get this to work I have added some android specific stuff
to the api/contract.
The presumption seems to be that certain information is in some global variable.
This doesn't seem quite right.
What I am wondering is if there shouldn't be some generalization of
context for slf4j.
The specific implementation would change it as needed.
What do you think?
More information about the slf4j-dev
mailing list