In Java, it's easy to invoke a default Logger object with minimal ceremony and zero configuration:
import java.util.logging.*;
public class Whatever {
private static final Logger log = Logger.getLogger("com.foo.Whatever");
public void doSomething() {
log.debug("doing something");
}
}
Assuming C# has a comparable equivalent (a default, console-outputting ILogger that can be easily invoked from a console application with minimal ceremony, doesn't require third-party frameworks, and is basically just a thin wrapper around Console.WriteLine()), what is it?
Alternatively, if there isn't a comparable default equivalent, can someone please show a simple example of how to do it in a C# console app?
My question SPECIFICALLY refers to ILogger.
There's a specific reason why I want to use ILogger -- my library will eventually be used by a Unity3d application. I don't know how to do it (yet), but apparently there's some way to make UnityEngine's Debug.Log Logger look like an ILogger to non-Unity libraries.
Basically, I want to be able to reap the benefits of UnityEngine's Debug.Log when the library runs under Unity, without making it dependent upon UnityEngine's Debug.Log to be able to compile or run at all. Getting an ILogger to work in a Console app is just the first step on a much longer journey.