diff --git a/components/platform_console/app_squeezelite/cmd_squeezelite.c b/components/platform_console/app_squeezelite/cmd_squeezelite.c index 295219b2..9357d7b4 100644 --- a/components/platform_console/app_squeezelite/cmd_squeezelite.c +++ b/components/platform_console/app_squeezelite/cmd_squeezelite.c @@ -65,7 +65,8 @@ static void squeezelite_thread(void *arg){ ESP_LOGI(TAG ,"Calling squeezelite"); int ret = squeezelite_main(thread_parms.argc, thread_parms.argv); - messaging_post_message(MESSAGING_WARNING, MESSAGING_CLASS_SYSTEM, "squeezelite exited with error code %d", ret); + messaging_post_message(ret > 1 ? MESSAGING_ERROR : MESSAGING_WARNING, + MESSAGING_CLASS_SYSTEM, "squeezelite exited with error code %d", ret); if (ret == 1) { int wait = 60; diff --git a/components/squeezelite/main.c b/components/squeezelite/main.c index 07f0ed97..f4981677 100644 --- a/components/squeezelite/main.c +++ b/components/squeezelite/main.c @@ -386,7 +386,7 @@ int squeezelite_main(int argc, char **argv) { optarg = NULL; optind += 1; } else { - fprintf(stderr, "\nOption error: -%s\n\n", opt); + LOG_ERROR("=> Option error: -%s", opt); usage(argv[0]); exit(1); } @@ -437,7 +437,7 @@ int squeezelite_main(int argc, char **argv) { if (!strcmp(l, "all") || !strcmp(l, "ir")) log_ir = new; #endif } else { - fprintf(stderr, "\nDebug settings error: -d %s\n\n", optarg); + LOG_ERROR("=> Debug settings error: -d %s", optarg); usage(argv[0]); exit(1); } @@ -451,7 +451,7 @@ int squeezelite_main(int argc, char **argv) { int byte = 0; char *tmp; if (!strncmp(optarg, "00:04:20", 8)) { - LOG_ERROR("ignoring mac address from hardware player range 00:04:20:**:**:**"); + LOG_ERROR("=> ignoring mac address from hardware player range 00:04:20:**:**:**"); } else { char *t = strtok(optarg, ":"); while (t && byte < 6) { @@ -689,14 +689,14 @@ int squeezelite_main(int argc, char **argv) { exit(0); break; default: - fprintf(stderr, "Arg error: %s\n", argv[optind]); + LOG_ERROR("=> arg error: %s", argv[optind]); break; } } // warn if command line includes something which isn't parsed if (optind < argc) { - fprintf(stderr, "\nError: command line argument error\n\n"); + LOG_ERROR("=> command line argument error"); usage(argv[0]); exit(1); } @@ -806,7 +806,7 @@ int squeezelite_main(int argc, char **argv) { #endif if (name && namefile) { - fprintf(stderr, "-n and -N option should not be used at same time\n"); + LOG_ERROR("=> -n and -N option should not be used at same time"); exit(1); } diff --git a/components/squeezelite/utils.c b/components/squeezelite/utils.c index 7be5cf59..b9b1188e 100644 --- a/components/squeezelite/utils.c +++ b/components/squeezelite/utils.c @@ -69,7 +69,11 @@ const char *logtime(void) { struct timeval tv; gettimeofday(&tv, NULL); strftime(buf, sizeof(buf), "[%T.", localtime(&tv.tv_sec)); - sprintf(buf+strlen(buf), "%06ld]", (long)tv.tv_usec); +#ifdef EMBEDDED + sprintf(buf+strlen(buf), "%03ld]", (long)tv.tv_usec/1000); +#else + sprintf(buf+strlen(buf), "%06ld]", (long)tv.tv_usec); +#endif #endif return buf; }