Remove LOGC()

It is not clear when to use LOGC() rather than LOGE(). Always use
LOGE().

Moreover, enum sc_log_level has no "critical" log level.
This commit is contained in:
Romain Vimont 2022-02-05 14:06:03 +01:00
parent f20137d2ac
commit 61b6324ee9
14 changed files with 23 additions and 24 deletions

View file

@ -113,7 +113,7 @@ sc_controller_start(struct sc_controller *controller) {
bool ok = sc_thread_create(&controller->thread, run_controller,
"scrcpy-ctl", controller);
if (!ok) {
LOGC("Could not start controller thread");
LOGE("Could not start controller thread");
return false;
}

View file

@ -276,7 +276,7 @@ sc_demuxer_start(struct sc_demuxer *demuxer) {
bool ok = sc_thread_create(&demuxer->thread, run_demuxer, "scrcpy-demuxer",
demuxer);
if (!ok) {
LOGC("Could not start demuxer thread");
LOGE("Could not start demuxer thread");
return false;
}
return true;

View file

@ -156,7 +156,7 @@ sc_file_pusher_start(struct sc_file_pusher *fp) {
bool ok = sc_thread_create(&fp->thread, run_file_pusher, "scrcpy-file", fp);
if (!ok) {
LOGC("Could not start file_pusher thread");
LOGE("Could not start file_pusher thread");
return false;
}

View file

@ -114,7 +114,7 @@ receiver_start(struct receiver *receiver) {
bool ok = sc_thread_create(&receiver->thread, run_receiver,
"scrcpy-receiver", receiver);
if (!ok) {
LOGC("Could not start receiver thread");
LOGE("Could not start receiver thread");
return false;
}

View file

@ -290,7 +290,7 @@ sc_recorder_open(struct sc_recorder *recorder, const AVCodec *input_codec) {
ok = sc_thread_create(&recorder->thread, run_recorder, "scrcpy-recorder",
recorder);
if (!ok) {
LOGC("Could not start recorder thread");
LOGE("Could not start recorder thread");
goto error_avio_close;
}

View file

@ -269,7 +269,7 @@ scrcpy(struct scrcpy_options *options) {
// Minimal SDL initialization
if (SDL_Init(SDL_INIT_EVENTS)) {
LOGC("Could not initialize SDL: %s", SDL_GetError());
LOGE("Could not initialize SDL: %s", SDL_GetError());
return false;
}
@ -341,7 +341,7 @@ scrcpy(struct scrcpy_options *options) {
// Initialize SDL video in addition if display is enabled
if (options->display && SDL_Init(SDL_INIT_VIDEO)) {
LOGC("Could not initialize SDL: %s", SDL_GetError());
LOGE("Could not initialize SDL: %s", SDL_GetError());
goto end;
}

View file

@ -423,14 +423,14 @@ sc_screen_init(struct sc_screen *screen,
screen->window =
SDL_CreateWindow(params->window_title, 0, 0, 0, 0, window_flags);
if (!screen->window) {
LOGC("Could not create window: %s", SDL_GetError());
LOGE("Could not create window: %s", SDL_GetError());
goto error_destroy_fps_counter;
}
screen->renderer = SDL_CreateRenderer(screen->window, -1,
SDL_RENDERER_ACCELERATED);
if (!screen->renderer) {
LOGC("Could not create renderer: %s", SDL_GetError());
LOGE("Could not create renderer: %s", SDL_GetError());
goto error_destroy_window;
}
@ -479,7 +479,7 @@ sc_screen_init(struct sc_screen *screen,
params->frame_size.height);
screen->texture = create_texture(screen);
if (!screen->texture) {
LOGC("Could not create texture: %s", SDL_GetError());
LOGE("Could not create texture: %s", SDL_GetError());
goto error_destroy_renderer;
}
@ -666,7 +666,7 @@ prepare_for_frame(struct sc_screen *screen, struct sc_size new_frame_size) {
screen->frame_size.width, screen->frame_size.height);
screen->texture = create_texture(screen);
if (!screen->texture) {
LOGC("Could not create texture: %s", SDL_GetError());
LOGE("Could not create texture: %s", SDL_GetError());
return false;
}
}

View file

@ -176,7 +176,7 @@ sc_process_execute_p(const char *const argv[], sc_pid *pid, unsigned flags,
bool
sc_process_terminate(pid_t pid) {
if (pid <= 0) {
LOGC("Requested to kill %d, this is an error. Please report the bug.\n",
LOGE("Requested to kill %d, this is an error. Please report the bug.\n",
(int) pid);
abort();
}

View file

@ -278,7 +278,7 @@ sc_aoa_start(struct sc_aoa *aoa) {
bool ok = sc_thread_create(&aoa->thread, run_aoa_thread, "scrcpy-aoa", aoa);
if (!ok) {
LOGC("Could not start AOA thread");
LOGE("Could not start AOA thread");
return false;
}

View file

@ -56,7 +56,7 @@ scrcpy_otg(struct scrcpy_options *options) {
// Minimal SDL initialization
if (SDL_Init(SDL_INIT_EVENTS)) {
LOGC("Could not initialize SDL: %s", SDL_GetError());
LOGE("Could not initialize SDL: %s", SDL_GetError());
return false;
}

View file

@ -15,10 +15,9 @@
#define LOGI(...) SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, __VA_ARGS__)
#define LOGW(...) SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, __VA_ARGS__)
#define LOGE(...) SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, __VA_ARGS__)
#define LOGC(...) SDL_LogCritical(SDL_LOG_CATEGORY_APPLICATION, __VA_ARGS__)
#define LOG_OOM() \
LOGC("OOM: %s:%d %s()", __FILE__, __LINE__, __func__)
LOGE("OOM: %s:%d %s()", __FILE__, __LINE__, __func__)
void
sc_set_log_level(enum sc_log_level level);

View file

@ -33,7 +33,7 @@ net_init(void) {
WSADATA wsa;
int res = WSAStartup(MAKEWORD(2, 2), &wsa) < 0;
if (res < 0) {
LOGC("WSAStartup failed with error %d", res);
LOGE("WSAStartup failed with error %d", res);
return false;
}
#endif

View file

@ -54,7 +54,7 @@ sc_mutex_lock(sc_mutex *mutex) {
int r = SDL_LockMutex(mutex->mutex);
#ifndef NDEBUG
if (r) {
LOGC("Could not lock mutex: %s", SDL_GetError());
LOGE("Could not lock mutex: %s", SDL_GetError());
abort();
}
@ -74,7 +74,7 @@ sc_mutex_unlock(sc_mutex *mutex) {
int r = SDL_UnlockMutex(mutex->mutex);
#ifndef NDEBUG
if (r) {
LOGC("Could not lock mutex: %s", SDL_GetError());
LOGE("Could not lock mutex: %s", SDL_GetError());
abort();
}
#else
@ -118,7 +118,7 @@ sc_cond_wait(sc_cond *cond, sc_mutex *mutex) {
int r = SDL_CondWait(cond->cond, mutex->mutex);
#ifndef NDEBUG
if (r) {
LOGC("Could not wait on condition: %s", SDL_GetError());
LOGE("Could not wait on condition: %s", SDL_GetError());
abort();
}
@ -140,7 +140,7 @@ sc_cond_timedwait(sc_cond *cond, sc_mutex *mutex, sc_tick deadline) {
int r = SDL_CondWaitTimeout(cond->cond, mutex->mutex, ms);
#ifndef NDEBUG
if (r < 0) {
LOGC("Could not wait on condition with timeout: %s", SDL_GetError());
LOGE("Could not wait on condition with timeout: %s", SDL_GetError());
abort();
}
@ -156,7 +156,7 @@ sc_cond_signal(sc_cond *cond) {
int r = SDL_CondSignal(cond->cond);
#ifndef NDEBUG
if (r) {
LOGC("Could not signal a condition: %s", SDL_GetError());
LOGE("Could not signal a condition: %s", SDL_GetError());
abort();
}
#else
@ -169,7 +169,7 @@ sc_cond_broadcast(sc_cond *cond) {
int r = SDL_CondBroadcast(cond->cond);
#ifndef NDEBUG
if (r) {
LOGC("Could not broadcast a condition: %s", SDL_GetError());
LOGE("Could not broadcast a condition: %s", SDL_GetError());
abort();
}
#else

View file

@ -274,7 +274,7 @@ sc_v4l2_sink_open(struct sc_v4l2_sink *vs) {
LOGD("Starting v4l2 thread");
ok = sc_thread_create(&vs->thread, run_v4l2_sink, "scrcpy-v4l2", vs);
if (!ok) {
LOGC("Could not start v4l2 thread");
LOGE("Could not start v4l2 thread");
goto error_av_packet_free;
}