[chronojump] Trying log facilities from Banshee project
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Trying log facilities from Banshee project
- Date: Mon, 22 Dec 2014 23:55:54 +0000 (UTC)
commit c1651320039ee3350b3e2c7023bd778888100202
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Dec 23 00:54:26 2014 +0100
Trying log facilities from Banshee project
chronojump_server/Makefile.am | 2 ++
src/Mini/Makefile.am | 2 ++
src/log.cs | 6 ++++--
src/logB.cs | 37 ++++++++++++++++++++++++++++++++++++-
src/sqlite/main.cs | 14 +++++++-------
5 files changed, 51 insertions(+), 10 deletions(-)
---
diff --git a/chronojump_server/Makefile.am b/chronojump_server/Makefile.am
index 968540e..afbe938 100644
--- a/chronojump_server/Makefile.am
+++ b/chronojump_server/Makefile.am
@@ -29,6 +29,8 @@ SOURCES = \
../src/multiChronopic.cs\
../src/sport.cs\
../src/log.cs\
+ ../src/logB.cs \
+ ../src/logConsoleCrayon.cs \
../src/serverPing.cs\
../src/serverEvaluator.cs\
../src/oldCodeNeedToDBConvert/person.cs\
diff --git a/src/Mini/Makefile.am b/src/Mini/Makefile.am
index 1f20b19..b228c81 100644
--- a/src/Mini/Makefile.am
+++ b/src/Mini/Makefile.am
@@ -8,6 +8,8 @@ SOURCES= \
../utilAll.cs \
../utilDate.cs \
../log.cs \
+ ../logB.cs \
+ ../logConsoleCrayon.cs \
../constants.cs
bin_SCRIPTS = chronojump_mini
diff --git a/src/log.cs b/src/log.cs
index 97b5697..af12011 100644
--- a/src/log.cs
+++ b/src/log.cs
@@ -173,8 +173,10 @@ public class Log
public static void WriteLine(string text)
{
- if(useConsole)
- Console.WriteLine(text);
+ if(useConsole) {
+ //Console.WriteLine(text);
+ LogB.Information(text);
+ }
else {
try {
writer.WriteLine(text);
diff --git a/src/logB.cs b/src/logB.cs
index f15d532..3f318d9 100644
--- a/src/logB.cs
+++ b/src/logB.cs
@@ -55,7 +55,8 @@ public enum LogEntryType
Debug,
Warning,
Error,
- Information
+ Information,
+ SQL
}
public class LogEntry
@@ -134,6 +135,9 @@ public static class LogB
case LogEntryType.Information:
ConsoleCrayon.ForegroundColor = ConsoleColor.Green;
break;
+ case LogEntryType.SQL:
+ ConsoleCrayon.ForegroundColor = ConsoleColor.Cyan;
+ break;
case LogEntryType.Debug:
ConsoleCrayon.ForegroundColor = ConsoleColor.Blue;
break;
@@ -173,6 +177,8 @@ public static class LogB
return "Error";
case LogEntryType.Information:
return "Info ";
+ case LogEntryType.SQL:
+ return "SQL ";
}
return null;
}
@@ -402,6 +408,35 @@ public static class LogB
#endregion
+#region Public SQL Methods
+
+ public static void SQL(string message)
+ {
+ SQL(message, null);
+ }
+
+ public static void SQL(string message, string details)
+ {
+ SQL(message, details, false);
+ }
+
+ public static void SQL(string message, string details, bool showUser)
+ {
+ Commit(LogEntryType.SQL, message, details, showUser);
+ }
+
+ public static void SQL(string message, bool showUser)
+ {
+ SQL(message, null, showUser);
+ }
+
+ public static void SQLFormat(string format, params object [] args)
+ {
+ SQL(String.Format(format, args));
+ }
+
+#endregion
+
#region Public Exception Methods
public static void DebugException(Exception e)
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index 6382ed0..2d3aa5d 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -92,23 +92,23 @@ class Sqlite
public static void Open()
{
try {
- Log.WriteLine("SQL ON");
+ LogB.SQL("SQL ON");
dbcon.Open();
} catch {
- Log.WriteLine("-- catched --");
+ LogB.SQL("-- catched --");
- Log.WriteLine("SQL OFF");
+ LogB.SQL("SQL OFF");
dbcon.Close();
- Log.WriteLine("SQL ON");
+ LogB.SQL("SQL ON");
dbcon.Open();
- Log.WriteLine("-- end of catched --");
+ LogB.SQL("-- end of catched --");
}
}
public static void Close()
{
- Log.WriteLine("SQL OFF");
+ LogB.SQL("SQL OFF");
dbcon.Close();
}
@@ -120,7 +120,7 @@ class Sqlite
Console.ReadLine();
*/
- Log.WriteLine("home is: " + home);
+ LogB.SQL("home is: " + home);
bool defaultDBLocation = true;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]