[banshee] [CollectionIndexer] Sync with current Hyena
- From: Bertrand Lorentz <blorentz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] [CollectionIndexer] Sync with current Hyena
- Date: Tue, 24 Aug 2010 19:37:51 +0000 (UTC)
commit 16cbc71d2dff9d9fcaeb2360f206419fdbedbf3f
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date: Tue Aug 24 21:35:24 2010 +0200
[CollectionIndexer] Sync with current Hyena
Update the embedded files with the latest from Hyena.
.../Hyena/DateTimeUtil.cs | 14 ++++++++++-
src/Core/Banshee.CollectionIndexer/Hyena/Log.cs | 24 +++++++++++++++----
2 files changed, 32 insertions(+), 6 deletions(-)
---
diff --git a/src/Core/Banshee.CollectionIndexer/Hyena/DateTimeUtil.cs b/src/Core/Banshee.CollectionIndexer/Hyena/DateTimeUtil.cs
index be77504..4a286c1 100644
--- a/src/Core/Banshee.CollectionIndexer/Hyena/DateTimeUtil.cs
+++ b/src/Core/Banshee.CollectionIndexer/Hyena/DateTimeUtil.cs
@@ -27,6 +27,7 @@
//
using System;
+using System.Globalization;
namespace Hyena
{
@@ -71,5 +72,16 @@ namespace Hyena
String.Format ("{0}:{1:00}:{2:00}", hours, minutes, seconds) :
String.Format ("{0}:{1:00}", minutes, seconds));
}
+
+ const string INVARIANT_FMT = "yyyy-MM-dd HH:mm:ss.fff zzz";
+ internal static string ToInvariantString (DateTime dt)
+ {
+ return dt.ToString (INVARIANT_FMT, CultureInfo.InvariantCulture);
+ }
+
+ internal static bool TryParseInvariant (string str, out DateTime dt)
+ {
+ return DateTime.TryParseExact (str, INVARIANT_FMT, CultureInfo.InvariantCulture, DateTimeStyles.None, out dt);
+ }
}
-}
+}
\ No newline at end of file
diff --git a/src/Core/Banshee.CollectionIndexer/Hyena/Log.cs b/src/Core/Banshee.CollectionIndexer/Hyena/Log.cs
index bab70e7..dddfcf3 100644
--- a/src/Core/Banshee.CollectionIndexer/Hyena/Log.cs
+++ b/src/Core/Banshee.CollectionIndexer/Hyena/Log.cs
@@ -29,6 +29,7 @@
using System;
using System.Text;
using System.Collections.Generic;
+using System.Threading;
namespace Hyena
{
@@ -110,13 +111,19 @@ namespace Hyena
if (type != LogEntryType.Information || (type == LogEntryType.Information && !showUser)) {
switch (type) {
case LogEntryType.Error: ConsoleCrayon.ForegroundColor = ConsoleColor.Red; break;
- case LogEntryType.Warning: ConsoleCrayon.ForegroundColor = ConsoleColor.Yellow; break;
+ case LogEntryType.Warning: ConsoleCrayon.ForegroundColor = ConsoleColor.DarkYellow; break;
case LogEntryType.Information: ConsoleCrayon.ForegroundColor = ConsoleColor.Green; break;
case LogEntryType.Debug: ConsoleCrayon.ForegroundColor = ConsoleColor.Blue; break;
}
- Console.Write ("[{0} {1:00}:{2:00}:{3:00}.{4:000}]", TypeString (type), DateTime.Now.Hour,
- DateTime.Now.Minute, DateTime.Now.Second, DateTime.Now.Millisecond);
+ var thread_name = String.Empty;
+ if (Debugging) {
+ var thread = Thread.CurrentThread;
+ thread_name = String.Format ("{0} ", thread.ManagedThreadId);
+ }
+
+ Console.Write ("[{5}{0} {1:00}:{2:00}:{3:00}.{4:000}]", TypeString (type), DateTime.Now.Hour,
+ DateTime.Now.Minute, DateTime.Now.Second, DateTime.Now.Millisecond, thread_name);
ConsoleCrayon.ResetColor ();
@@ -242,7 +249,7 @@ namespace Hyena
TimeSpan duration = finish - timers[id];
string d_message;
if (duration.TotalSeconds < 60) {
- d_message = String.Format ("{0}s", duration.TotalSeconds);
+ d_message = duration.TotalSeconds.ToString ();
} else {
d_message = duration.ToString ();
}
@@ -370,6 +377,13 @@ namespace Hyena
#region Public Exception Methods
+ internal static void DebugException (Exception e)
+ {
+ if (Debugging) {
+ Exception (e);
+ }
+ }
+
internal static void Exception (Exception e)
{
Exception (null, e);
@@ -387,7 +401,7 @@ namespace Hyena
while (exception_chain.Count > 0) {
e = exception_chain.Pop ();
- builder.AppendFormat ("{0} (in `{1}')", e.Message, e.Source).AppendLine ();
+ builder.AppendFormat ("{0}: {1} (in `{2}')", e.GetType (), e.Message, e.Source).AppendLine ();
builder.Append (e.StackTrace);
if (exception_chain.Count > 0) {
builder.AppendLine ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]