logger: Simplify layout
This commit is contained in:
parent
babf24e713
commit
63db135510
|
@ -22,8 +22,9 @@ namespace SparkleLib {
|
||||||
|
|
||||||
public static class SparkleLogger {
|
public static class SparkleLogger {
|
||||||
|
|
||||||
private static Object debug_lock = new Object ();
|
static object debug_lock = new object ();
|
||||||
private static int log_size = 0;
|
static int log_size;
|
||||||
|
|
||||||
|
|
||||||
public static void LogInfo (string type, string message)
|
public static void LogInfo (string type, string message)
|
||||||
{
|
{
|
||||||
|
@ -37,9 +38,9 @@ namespace SparkleLib {
|
||||||
string line;
|
string line;
|
||||||
|
|
||||||
if (string.IsNullOrEmpty (type))
|
if (string.IsNullOrEmpty (type))
|
||||||
line = timestamp + " | " + message;
|
line = timestamp + " " + message;
|
||||||
else
|
else
|
||||||
line = timestamp + " | " + type + " | " + message;
|
line = timestamp + " " + type + " | " + message;
|
||||||
|
|
||||||
if (exception != null)
|
if (exception != null)
|
||||||
line += ": " + exception.Message + " " + exception.StackTrace;
|
line += ": " + exception.Message + " " + exception.StackTrace;
|
||||||
|
@ -48,7 +49,6 @@ namespace SparkleLib {
|
||||||
Console.WriteLine (line);
|
Console.WriteLine (line);
|
||||||
|
|
||||||
lock (debug_lock) {
|
lock (debug_lock) {
|
||||||
// Don't let the log get bigger than 1000 lines
|
|
||||||
if (log_size >= 1000) {
|
if (log_size >= 1000) {
|
||||||
File.WriteAllText (SparkleConfig.DefaultConfig.LogFilePath, line + Environment.NewLine);
|
File.WriteAllText (SparkleConfig.DefaultConfig.LogFilePath, line + Environment.NewLine);
|
||||||
log_size = 0;
|
log_size = 0;
|
||||||
|
@ -76,8 +76,8 @@ namespace SparkleLib {
|
||||||
"https://github.com/hbons/SparkleShare/issues and include the lines below." + n + n +
|
"https://github.com/hbons/SparkleShare/issues and include the lines below." + n + n +
|
||||||
"Remove any sensitive information like file names, IP addresses, domain names, etc. if needed." + n + n +
|
"Remove any sensitive information like file names, IP addresses, domain names, etc. if needed." + n + n +
|
||||||
"------" + n + n +
|
"------" + n + n +
|
||||||
"SparkleShare version: " + SparkleLib.SparkleBackend.Version + n +
|
"SparkleShare version: " + SparkleBackend.Version + n +
|
||||||
"Operating system: " + SparkleLib.SparkleBackend.Platform + " (" + Environment.OSVersion + ")" + n;
|
"Operating system: " + SparkleBackend.Platform + " (" + Environment.OSVersion + ")" + n;
|
||||||
|
|
||||||
crash_report += e.GetType () + ": " + e.Message + n + e.StackTrace + n;
|
crash_report += e.GetType () + ": " + e.Message + n + e.StackTrace + n;
|
||||||
|
|
||||||
|
@ -103,4 +103,3 @@ namespace SparkleLib {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue