[Gpredict-svn] SF.net SVN: gpredict:[836] trunk
Real time satellite tracking and orbit prediction
Status: Beta
Brought to you by:
csete
|
From: <aa...@us...> - 2011-06-26 16:38:39
|
Revision: 836
http://gpredict.svn.sourceforge.net/gpredict/?rev=836&view=rev
Author: aa1vs
Date: 2011-06-26 16:38:33 +0000 (Sun, 26 Jun 2011)
Log Message:
-----------
Fixed log retention and deletion.
Modified Paths:
--------------
trunk/ChangeLog
trunk/NEWS
trunk/src/sat-log.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2011-06-26 03:58:08 UTC (rev 835)
+++ trunk/ChangeLog 2011-06-26 16:38:33 UTC (rev 836)
@@ -1,3 +1,9 @@
+2011-06-26 Charles Suprin <hamaa1vs at gmail.com>
+
+ * src/sat-log.c
+ Fix log retention and deletion.
+
+
2011-06-25 Charles Suprin <hamaa1vs at gmail.com>
* src/qth-data.c
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2011-06-26 03:58:08 UTC (rev 835)
+++ trunk/NEWS 2011-06-26 16:38:33 UTC (rev 836)
@@ -9,6 +9,7 @@
- Fixed bug 3294829: Program name wrong in desktop files.
- Fixed bug 3309110: 100% on manual time adjustment.
- Fixed bug 3272993: Issue controlling Yaesu FT-847.
+- Fixed bug 3334657: Old log files not being saved.
Changes in version 1.3 (1 Mar 2011)
Modified: trunk/src/sat-log.c
===================================================================
--- trunk/src/sat-log.c 2011-06-26 03:58:08 UTC (rev 835)
+++ trunk/src/sat-log.c 2011-06-26 16:38:33 UTC (rev 836)
@@ -146,16 +146,15 @@
void
sat_log_close ()
{
- if (initialised) {
- sat_log_log (SAT_LOG_LEVEL_MSG,
- _("%s: Session ended"), __FUNCTION__);
+ if (initialised) {
+ sat_log_log (SAT_LOG_LEVEL_MSG,
+ _("%s: Session ended"), __FUNCTION__);
g_io_channel_shutdown (logfile, TRUE, NULL);
g_io_channel_unref (logfile);
logfile = NULL;
- initialised = FALSE;
- if (sat_cfg_get_bool (SAT_CFG_BOOL_KEEP_LOG_FILES)) {
- log_rotate ();
- }
+ initialised = FALSE;
+ /* Always call log_rotate to get rid of old logs */
+ log_rotate ();
}
}
@@ -290,32 +289,32 @@
glong then; /* time in sec corresponding to age */
gchar *confdir,*dirname,*fname1,*fname2;
-
- /* initialise some vars */
- g_get_current_time (&now);
+ /* get cleaning age; if age non-zero do not rename log */
+ age = sat_cfg_get_int (SAT_CFG_INT_LOG_CLEAN_AGE);
+
+ /* initialise some vars */
+ g_get_current_time (&now);
confdir = get_user_conf_dir ();
dirname = g_strconcat (confdir, G_DIR_SEPARATOR_S, "logs", NULL);
- fname1 = g_strconcat (dirname, G_DIR_SEPARATOR_S, "gpredict.log", NULL);
- fname2 = g_strdup_printf ("%s%sgpredict-%ld.log",
- dirname, G_DIR_SEPARATOR_S, now.tv_sec);
+ fname1 = g_strconcat (dirname, G_DIR_SEPARATOR_S, "gpredict.log", NULL);
+ fname2 = g_strdup_printf ("%s%sgpredict-%ld.log",
+ dirname, G_DIR_SEPARATOR_S, now.tv_sec);
+
+ if (age > 0)
+ g_rename (fname1, fname2);
+
- g_rename (fname1, fname2);
-
-
- /* get cleaning age; if age non-zero perform cleaning */
- age = sat_cfg_get_int (SAT_CFG_INT_LOG_CLEAN_AGE);
- if (age > 0) {
-
- /* calculate age for files that should be removed */
- then = now.tv_sec - age;
- clean_log_dir (dirname, then);
-
- }
-
- g_free (dirname);
- g_free (fname1);
- g_free (fname2);
+ /* calculate age for files that should be removed */
+ then = now.tv_sec - age;
+
+ /* cleanup every time as old log files should be deleted if they exist */
+ clean_log_dir (dirname, then);
+
+
+ g_free (dirname);
+ g_free (fname1);
+ g_free (fname2);
g_free (confdir);
}
@@ -353,7 +352,7 @@
vbuf = g_strsplit_set (fname, "-.", -1);
- g_print ("%s <=> %s\n", vbuf[1], ages);
+ //g_print ("%s <=> %s\n", vbuf[1], ages);
/* Remove file if too old */
if (g_ascii_strcasecmp (vbuf[1], ages) <= 0) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|