thorpedosg

ff9HY7aW

Aug 6th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. internal static void LocalLog(Exception trace)
  2. {
  3. try
  4. {
  5. string InfoText = string.Empty;
  6. if (trace != null)
  7. {
  8. InfoText += Environment.NewLine + Newtonsoft.Json.JsonConvert.SerializeObject(trace, Newtonsoft.Json.Formatting.Indented)
  9. + Environment.NewLine;
  10. }
  11.  
  12.  
  13. var path = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\";
  14. if (!Directory.Exists(path))
  15. Directory.CreateDirectory(path);
  16.  
  17. var logfile = path + "\\" + DateTime.Now.Year + "." + DateTime.Now.Month + "." + DateTime.Now.Day + " WSRecaudoTercero.log";
  18. File.AppendAllText(logfile, DateTime.Now + " - " + Environment.NewLine + InfoText + Environment.NewLine + Environment.NewLine);
  19. }
  20. catch
  21. {
  22. //asdf
  23. }
  24. }
Add Comment
Please, Sign In to add comment