zeitgeist team mailing list archive
-
zeitgeist team
-
Mailing list archive
-
Message #04995
[Branch ~zeitgeist/zeitgeist/bluebird] Rev 410: - Remove unused (and incomplete) code for automatic log rotation.
------------------------------------------------------------
revno: 410
committer: Siegfried-Angel Gevatter Pujals <siegfried@xxxxxxxxxxxx>
branch nick: bluebird
timestamp: Thu 2012-03-01 15:47:30 +0100
message:
- Remove unused (and incomplete) code for automatic log rotation.
- Move date_string generation into the log_file!=null if.
modified:
src/logging.vala
src/utils.vala
src/zeitgeist-daemon.vala
--
lp:zeitgeist
https://code.launchpad.net/~zeitgeist/zeitgeist/bluebird
Your team Zeitgeist Framework Team is subscribed to branch lp:zeitgeist.
To unsubscribe from this branch go to https://code.launchpad.net/~zeitgeist/zeitgeist/bluebird/+edit-subscription
=== modified file 'src/logging.vala'
--- src/logging.vala 2012-03-01 14:44:32 +0000
+++ src/logging.vala 2012-03-01 14:47:30 +0000
@@ -82,12 +82,6 @@
string log_level = get_log_level_string (log_levels, out color);
string timestamp = TimeVal ().to_iso8601 ().substring (11, 15);
- DateTime datetime = new DateTime.now_local ();
- string date_string = "%s,%.3d".printf (
- datetime.format ("%Y-%m-%d %H:%M:%S"),
- (int) ((datetime.get_microsecond () / 1000.0)));
- int pid = Posix.getpid ();
-
unowned FileStream output;
if (log_levels >= LogLevelFlags.LEVEL_MESSAGE)
output = stdout; // MESSAGE, INFO or DEBUG
@@ -101,12 +95,18 @@
// Log to file
if (Logging.log_file != null)
{
+ DateTime datetime = new DateTime.now_local ();
+ string date_string = "%s,%.3d".printf (
+ datetime.format ("%Y-%m-%d %H:%M:%S"),
+ (int) ((datetime.get_microsecond () / 1000.0)));
+ int pid = Posix.getpid ();
+
Logging.log_file.printf ("%d [%s] - %s - %s\n",
pid, date_string, log_level, message);
}
}
- public static void setup_logging (string name, string? log_level,
+ public static void setup_logging (string? log_level,
string? log_file=null)
{
LogLevelFlags discarded = LogLevelFlags.LEVEL_DEBUG;
@@ -139,19 +139,6 @@
if (discarded != 0)
Log.set_handler (null, discarded, () => {});
- /*
- try
- {
- string filename = rotate_and_get_log_file (name);
- log_file = FileStream.open (filename, "a");
- }
- catch (Error e)
- {
- warning ("Couldn't setup file logging: %s", e.message);
- log_file = null;
- }
- */
-
if (log_file != null)
Logging.log_file = FileStream.open (log_file, "a");
@@ -159,35 +146,6 @@
Log.set_handler (null, logged, log_handler);
}
- /*
- private static string rotate_and_get_log_file (string name) throws Error
- {
- string log_path = Utils.get_logging_path ();
- string filename = Path.build_path (Path.DIR_SEPARATOR_S,
- log_path, "%s.log".printf (name));
-
- File log_file = File.new_for_path (filename);
- try
- {
- FileInfo info = log_file.query_info (
- FILE_ATTRIBUTE_TIME_MODIFIED, FileQueryInfoFlags.NONE);
-
- TimeVal last_log_time_val;
- info.get_modification_time (out last_log_time_val);
-
- Date last_log_date = Date();
- last_log_date.set_time_val (last_log_time_val);
- }
- catch (Error e)
- {
- if (!(e is IOError.NOT_FOUND))
- throw e;
- }
-
- return filename;
- }
- */
-
}
}
=== modified file 'src/utils.vala'
--- src/utils.vala 2012-03-01 14:44:32 +0000
+++ src/utils.vala 2012-03-01 14:47:30 +0000
@@ -66,14 +66,6 @@
DATA_FOLDER);
}
-/*
- public string get_logging_path ()
- {
- return Path.build_filename (Environment.get_user_cache_dir (),
- DATA_FOLDER);
- }
-*/
-
public unowned string get_database_file_path ()
{
if (DATABASE_FILE_PATH != null) return DATABASE_FILE_PATH;
=== modified file 'src/zeitgeist-daemon.vala'
--- src/zeitgeist-daemon.vala 2012-03-01 14:44:32 +0000
+++ src/zeitgeist-daemon.vala 2012-03-01 14:47:30 +0000
@@ -457,7 +457,7 @@
return 0;
}
- Logging.setup_logging ("daemon", log_level, log_file);
+ Logging.setup_logging (log_level, log_file);
run ();
}