wlserver: set wlroots log handler
This commit is contained in:
parent
c034ac1f99
commit
22323418ac
2 changed files with 21 additions and 2 deletions
|
|
@ -19,13 +19,14 @@ class LogScope {
|
|||
|
||||
bool has(enum LogPriority priority);
|
||||
void vprintf(enum LogPriority priority, const char *fmt, va_list args) ATTRIB_PRINTF(3, 0);
|
||||
void vlogf(enum LogPriority priority, const char *fmt, va_list args) ATTRIB_PRINTF(3, 0);
|
||||
void logf(enum LogPriority priority, const char *fmt, ...) ATTRIB_PRINTF(3, 4);
|
||||
|
||||
public:
|
||||
LogScope(const char *name);
|
||||
LogScope(const char *name, enum LogPriority priority);
|
||||
|
||||
void vlogf(enum LogPriority priority, const char *fmt, va_list args) ATTRIB_PRINTF(3, 0);
|
||||
|
||||
void errorf(const char *fmt, ...) ATTRIB_PRINTF(2, 3);
|
||||
void infof(const char *fmt, ...) ATTRIB_PRINTF(2, 3);
|
||||
void debugf(const char *fmt, ...) ATTRIB_PRINTF(2, 3);
|
||||
|
|
|
|||
|
|
@ -518,8 +518,26 @@ static void handle_session_active( struct wl_listener *listener, void *data )
|
|||
wl_log.infof( "Session %s", g_DRM.paused ? "paused" : "resumed" );
|
||||
}
|
||||
|
||||
static void handle_wlr_log(enum wlr_log_importance importance, const char *fmt, va_list args)
|
||||
{
|
||||
enum LogPriority prio;
|
||||
switch (importance) {
|
||||
case WLR_ERROR:
|
||||
prio = LOG_ERROR;
|
||||
break;
|
||||
case WLR_INFO:
|
||||
prio = LOG_INFO;
|
||||
break;
|
||||
default:
|
||||
prio = LOG_DEBUG;
|
||||
break;
|
||||
}
|
||||
|
||||
wl_log.vlogf(prio, fmt, args);
|
||||
}
|
||||
|
||||
int wlsession_init( void ) {
|
||||
wlr_log_init(WLR_DEBUG, NULL);
|
||||
wlr_log_init(WLR_DEBUG, handle_wlr_log);
|
||||
|
||||
wlserver.display = wl_display_create();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue