]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - fade.c
fade: Add --loglevel option.
[paraslash.git] / fade.c
diff --git a/fade.c b/fade.c
index cbfb62308a79ab85aa73b2d3f88c77cb25a6c725..2954fa32689887e9b8703f0eb34c29e710e6c072 100644 (file)
--- a/fade.c
+++ b/fade.c
@@ -25,12 +25,15 @@ DECLARE_MIXER_INITS;
 static struct mixer supported_mixer[] = {MIXER_ARRAY};
 #define FOR_EACH_MIXER(i) for ((i) = 0; (i) < NUM_SUPPORTED_MIXERS; (i)++)
 
-__printf_2_3 void date_log(__a_unused int ll, const char *fmt, ...)
+static int loglevel;
+__printf_2_3 void date_log(int ll, const char *fmt, ...)
 {
        va_list argp;
        time_t t1;
        struct tm *tm;
 
+       if (ll < loglevel)
+               return;
        time(&t1);
        tm = localtime(&t1);
        printf("%d:%02d:%02d ", tm->tm_hour, tm->tm_min, tm->tm_sec);
@@ -309,6 +312,7 @@ int main(int argc, char *argv[])
                fade_cmdline_parser_config_file(conf.config_file_arg,
                        &conf, &params);
        }
+       loglevel = get_loglevel_by_name(conf.loglevel_arg);
        init_mixers();
        m = get_mixer_or_die();
        ret = m->open(conf.mixer_device_arg, &h);