-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logging #19
Comments
log stuff Edit: In all seriousness though, here is my wishlist for the logging facility: [ ] Create seperate logging facilities per module instance: Each plugin gets its own little neat logger that it writes stuff to, this logger has its own level, they gotta stand up and tear down at any time. |
As discussed, here is a short comparison of how OTA.Logging.ProgramLog in OTAPI can assist. In short there are two main sections of how ProgramLog works.
Here is a quick example how to create and use a custom LogChannel. In general, var logger = new LogChannel("MyLogger", ConsoleColor.Cyan, System.Diagnostics.TraceLevel.Info)
{
Target = new FileOutputTarget(Path.Combine(Globals.LogFolderPath, "myloggger.log"), true /*Log rotation*/)
};
logger.Log("Something has occurred");
logger.Log("Today is... {0:dd/MM/yyyy}", DateTime.Now);
try
{
throw new Exception("Test exception 1");
}
catch (Exception e)
{
logger.Log(e);
}
try
{
throw new InvalidOperationException("Test exception 2");
}
catch (Exception e)
{
logger.Log(e, "Oh noes Test exception 2");
}
logger.Log("Finishing");
logger.Close(); Contents of server_20160121_1420.log
Contents of myloggger_20160121_1420.log:
|
An external library like Serilog is probably our best bet. |
What do we want our logger to do?
The text was updated successfully, but these errors were encountered: