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

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



Ack.

--
Martin Sivák
msivak redhat com
Red Hat Czech
Anaconda team / Brno, CZ

----- "Ales Kozumplik" <akozumpl redhat com> wrote:

> 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 redhat com
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list


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