[tasque] Prevent crash when logging strings that contain curly braces (LP:451015)
- From: Sanford Armstrong <sharm src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tasque] Prevent crash when logging strings that contain curly braces (LP:451015)
- Date: Sun, 18 Oct 2009 06:50:14 +0000 (UTC)
commit 8eacf29f2a7a4d295d3ccae13272bd1eef2a9dc0
Author: Sandy Armstrong <sanfordarmstrong gmail com>
Date: Sat Oct 17 23:48:40 2009 -0700
Prevent crash when logging strings that contain curly braces (LP:451015)
Do not use formatting WriteLine overloads unless requested.
src/Logger.cs | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/Logger.cs b/src/Logger.cs
index be612a7..b3c70fa 100644
--- a/src/Logger.cs
+++ b/src/Logger.cs
@@ -50,7 +50,10 @@ namespace Tasque
public void Log (LogLevel lvl, string msg, params object[] args)
{
msg = string.Format ("[{0}]: {1}", Enum.GetName (typeof (LogLevel), lvl), msg);
- Console.WriteLine (msg, args);
+ if (args.Length > 0)
+ Console.WriteLine (msg, args);
+ else
+ Console.WriteLine (msg);
}
}
@@ -98,7 +101,10 @@ namespace Tasque
DateTime.Now.ToString(),
Enum.GetName (typeof (LogLevel), lvl),
msg);
- log.WriteLine (msg, args);
+ if (args.Length > 0)
+ log.WriteLine (msg, args);
+ else
+ log.WriteLine (msg);
log.Flush();
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]