ETLog
My simple "Log writer" class
Class for log files and display messages in the console. It will create folder "log" in app folfer and will make log file for every day
Now avalible on https://www.nuget.org/packages/ET.ETLog/
Usage
create ETLoger : new ETLoger(LOGFILE_NAME, LOGFILE_WRITEMODE, CONSOLE_WRITEMODE);
LOGFILE is name of file
LOGFILE_WRITEMODE is type of enum, and can be WriteMode.Full,WriteMode.ErrorAndWarning, WriteMode.OnlyError, WriteMode.Nothing
CONSOLE_WRITEMODE is type of enum, and can be WriteMode.Full,WriteMode.ErrorAndWarning, WriteMode.OnlyError, WriteMode.Nothing
WriteMode.Full = all will be writen
WriteMode.ErrorAndWarning = write only errors and warnings, no message
WriteMode.OnlyError = write only errors, no warnings or messame
WriteMode.Nothing = nothing will be writen
Usage
Create (Log will start new thread for async work, do not forget to dispose it)
ETLoger Log = new ETLoger("TestLog", WriteMode.OnlyError, WriteMode.Full);
Write message
Log.WriteLine("TestLog"); //will write new line with "$datetime.now : TestLog"
Log.Write("TestLog"); //will write "TestLog"
Write warning message (in console it will be in changed color)
Log.WarnWriteLine("TestLog"); //will write new line with "$datetime.now : (!) TestLog"
Log.WarnWrite("TestLog"); //will write "TestLog"
Write error message (in console it will be in changed color)
Log.ErrWriteLine("TestLog"); //will write new line with "$datetime.now : (!!!) TestLog"
Log.ErrWrite("TestLog"); //will write "TestLog"
Set logger name
Log.SetName("Logger");
// now log will be write with name, for example
Log.WriteLine("TestLog"); // now will write "Logger : $datetime.now : TestLog"
Despose (the thread will desposed only when all entries are recorded)
Log.Dispose(); //end log thread
all in parentheses is an object.ToString()
Ver 1.1.4
Now you can change WriteMode by setter for LogMode and ConsoleMode, but there will be written error message that mode is changed like "(!!!) WRITE MODE FOR LOG WAS CHANGED ON "Nothing"
Ver 1.1.7
add Dispose fot kill log thread
Ver 1.1.8
add SetName(string)