I am trying to remove some log-dependent dependencies and came across a Castle Windsor logging tool. However, I am skeptical about whether I should use it or not.
public class MyClass
{
public Castle.Core.Logging.ILogger Logger { get; set; }
...
}
The Windsor Logging Service requires that you set your log as a property. Is this a really good practice? I feel like I almost break encapsulation because, as a rule, when I reuse a component, I don't need a registration mechanism, and I usually don't want to see it open.
If I use a custom wrapper that uses a static class to create a log, I can keep it private. For instance:
public class MyClass
{
private static MyCustomWrapper.ILogger Logger = LogManager.GetLogger(typeof(MyClass));
...
}
, , , , , . . , . .