WriteLog - ParlocameonTheDev/Parlocameon.Generic.Logger-Loggy GitHub Wiki

Description

This is used by me to update log files, although I could start it this way. It takes a dirpath and filename like the WriteLog, overridden the same way.


Example Path: C:\Users\user\appdata\mysoftware
WHAT NOT TO DO:

  • C:\Users\user\appdata\mysoftware

Example

Finally, an example of it being used.

//params
WriteLog(String dirpath, String filename, String message, Headers h);
String appDataLocalPath = Logspace.appDataLocalPath;
String dirpath = appDataLocalPath + @"\myprogram\";

//WAYS TO USE
WriteLog(dirpath, "my.log", "this is my message", Headers.INFO);
//OUTPUT: my.log -> [INFO]: this is my message
WriteLog(dirpath+@"my.log", null, ip + "CONNECTED", Headers.STATUS);
//OUTPUT: my.log -> [STATUS]: xx.xxx.xxx.xxxx CONNECTED

Custom Arguments

Header types

  • Headers.None, displays no header before the log.
  • Headers.STATUS, displays a status header, good for starting up applications, etc.
  • Headers.WARNING, good to use for debugging, or logging possible problems.
  • Headers.INFO, information such as IP's connecting to a server, or a command run, etc.
  • Headers.ERROR, used when there is a critical error in an application. NOTE: Usually will not work unless you're smart enough to try{} catch{} that error. Heh.