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

Re: [master 1/2] Make loader log into syslog (so remote logging works for it as well) (#524980)



> +static const char * syslog_facility = "loader";
> +
> +/* maps our loglevel to syslog loglevel */
> +static int mapLogLevel(int level)
> +{
> +    int syslog_level;
> +    switch (level) {
> +    case DEBUGLVL:
> +        syslog_level = LOG_DEBUG;
> +        break;
> +    case INFO:
> +        syslog_level = LOG_INFO;
> +        break;
> +    case WARNING:
> +        syslog_level = LOG_WARNING;
> +        break;
> +    case CRITICAL:
> +        syslog_level = LOG_CRIT;
> +        break;
> +    case ERROR:
> +    default:
> +        /* if someone called us with an invalid level value, log it as an error
> +           too. */
> +        syslog_level = LOG_ERR;
> +        break;
> +    }
> +    return syslog_level;
> +}

You could simplify this down to just have each branch of the case
statement return LOG_* instead of setting a variable and then returning
that.

Otherwise, both patches look fine.

- Chris


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