[master 3/5] logging: give loglevels for the shortened names.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Renames loglevels to have the same names as in syslog, so they read the
same locally and remotely. WARNING is now WARN, ERROR is now ERR, CRITICAL
is now CRIT.
---
 anaconda_log.py |    4 ++++
 isys/log.c      |    6 +++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/anaconda_log.py b/anaconda_log.py
index 961cba1..d8d3bb5 100644
--- a/anaconda_log.py
+++ b/anaconda_log.py
@@ -73,6 +73,10 @@ class AnacondaLog:
     def __init__ (self):
         self.tty_loglevel = DEFAULT_TTY_LEVEL
         self.remote_syslog = None
+        # Rename the loglevels so they are the same as in syslog.
+        logging.addLevelName(logging.WARNING, "WARN")
+        logging.addLevelName(logging.ERROR, "ERR")
+        logging.addLevelName(logging.CRITICAL, "CRIT")
         # Create the base of the logger hierarcy.
         logger = logging.getLogger("anaconda")
         logger.setLevel(logging.DEBUG)
diff --git a/isys/log.c b/isys/log.c
index d887b56..91ca1bc 100644
--- a/isys/log.c
+++ b/isys/log.c
@@ -82,17 +82,17 @@ static void printLogHeader(int level, const char *tag, FILE *outfile) {
             break;
 
         case WARNING:
-            fprintf (outfile, "%02d:%02d:%02d,%03d WARNING %s: ", t->tm_hour,
+            fprintf (outfile, "%02d:%02d:%02d,%03d WARN %s: ", t->tm_hour,
                      t->tm_min, t->tm_sec, msecs, tag);
             break;
 
         case ERROR:
-            fprintf (outfile, "%02d:%02d:%02d,%03d ERROR %s: ", t->tm_hour,
+            fprintf (outfile, "%02d:%02d:%02d,%03d ERR %s: ", t->tm_hour,
                      t->tm_min, t->tm_sec, msecs, tag);
             break;
 
         case CRITICAL:
-            fprintf (outfile, "%02d:%02d:%02d,%03d CRITICAL %s: ", t->tm_hour,
+            fprintf (outfile, "%02d:%02d:%02d,%03d CRIT %s: ", t->tm_hour,
                      t->tm_min, t->tm_sec, msecs, tag);
             break;
     }
-- 
1.6.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux