inversion of control - Castle windsor logging facility -
i'm trying remove logging dependencies , stumbled across castle windsor's logging facility. however, i'm kind of skeptical whether should use or not.
public class myclass { public castle.core.logging.ilogger logger { get; set; } ... }
windsor's logging facility requires expose logger property. practice? feel i'm breaking encapsulation because when reuse component, don't care it's logging mechanism , don't want see exposed.
if use custom wrapper uses static class create log, can keep private. example:
public class myclass { private static mycustomwrapper.ilogger logger = logmanager.getlogger(typeof(myclass)); ... }
i've searched web reasons why should use logging facility, i'm finding articles on how use it, not why should use it. feel i'm missing point. having logging component exposed kind of scarying me away.
windsor's logging facility requires expose logger property.
not necessarily. can put logger constructor (i.e. mandatory) dependency. logger declared property (i.e optional dependency) because there might no logger. is, component should able function without logger.
if use custom wrapper uses static class create log
that's service locator, code couples myclass
logmanager
, imho worse trying away from.
Comments
Post a Comment