We're using Enterprise Library 4.1 for logging (and exception handling/cryptography).
Does anyone know a good way of determining the configured logging level at runtime? I've written a LogUtility class to to make the logging calls, and am calling it as per this example:
LogUtility.LogVerbose(
string.Format("Processing event {0}", currentEvent.EventIDImported),
MethodBase.GetCurrentMethod().Name,
this.GetType().Name
);
I understand that it won't actually get logged to file unless the logging level is set to an appropriate level, in app.config in my case. But I don't really want the method parameters, i.e. the method and type names, and in some cases the actual strings being logged, to be evaluated unless absolutely necessary.
Does this seem like a valid concern? Our app can have tens of millions of iterations and logging points. If possible I'd like to set a flag based on the configured log level, and check that before making the method call above.
EDIT - I guess in terms of the example above I could hard-code method and type names on every call. But I'd still like to know if there's a way of determining the level.