I don't use Castle or any other DI/IoC at the moment, so I can't comment on the validity or not or logging a static or a struct...
Having said that, it seems like it should not be too difficult to log from a static method (on a non-static class). It might be cheesy, but I suppose you could do something like this:
public class MyClass
{
private ILogger logger = NullLogger.Instance;
private static ILogger staticLogger;
public ILogger Logger
{
get
{
return logger;
}
set
{
logger = value;
if (staticLogger == null)
{
staticLogger = value;
}
}
}
public void MyMethod()
{
logger.Info("Hello from instance method!");
}
public static void MyStaticMethod()
{
staticLogger.Info("Hello from static method!");
}
}
Probably have to be careful not to log with the static logger before the real logger gets injected.