core: use the logging system all the way
Add a log handler early so we don't need to use fprintf for early logs. Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
87e4e10f15
commit
71ac1bfd30
11
src/picom.c
11
src/picom.c
|
@ -2294,8 +2294,17 @@ int main(int argc, char **argv) {
|
||||||
// Set locale so window names with special characters are interpreted
|
// Set locale so window names with special characters are interpreted
|
||||||
// correctly
|
// correctly
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
|
|
||||||
|
// Initialize logging system for early logging
|
||||||
log_init_tls();
|
log_init_tls();
|
||||||
|
|
||||||
|
{
|
||||||
|
auto stderr_logger = stderr_logger_new();
|
||||||
|
if (stderr_logger) {
|
||||||
|
log_add_target_tls(stderr_logger);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int exit_code;
|
int exit_code;
|
||||||
char *config_file = NULL;
|
char *config_file = NULL;
|
||||||
bool all_xerrors = false, need_fork = false;
|
bool all_xerrors = false, need_fork = false;
|
||||||
|
@ -2340,7 +2349,7 @@ int main(int argc, char **argv) {
|
||||||
do {
|
do {
|
||||||
Display *dpy = XOpenDisplay(NULL);
|
Display *dpy = XOpenDisplay(NULL);
|
||||||
if (!dpy) {
|
if (!dpy) {
|
||||||
fprintf(stderr, "Can't open display.");
|
log_fatal("Can't open display.");
|
||||||
ret_code = 1;
|
ret_code = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue