remove wlroots dependency from common code

Removes the wlroots dependency from the common code. To remove the
dependency on the header, the defines and log-level enum are copied
over.
This causes a redefine error if both the wlr and the sway log.h are
included.
This commit is contained in:
Markus Ongyerth 2018-05-24 21:55:52 +02:00
parent acae6ad40f
commit 3fb60b6aed
8 changed files with 14 additions and 8 deletions

View file

@ -1,12 +1,25 @@
#ifndef _SWAY_LOG_H
#define _SWAY_LOG_H
#include <wlr/util/log.h>
#include <stdbool.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>
typedef enum {
L_SILENT = 0,
L_ERROR = 1,
L_INFO = 2,
L_DEBUG = 3,
L_LAST,
} log_importance_t;
#ifdef __GNUC__
#define ATTRIB_PRINTF(start, end) __attribute__((format(printf, start, end)))
#else
#define ATTRIB_PRINTF(start, end)
#endif
void _sway_abort(const char *filename, ...) ATTRIB_PRINTF(1, 2);
#define sway_abort(FMT, ...) \
_sway_abort("[%s:%d] " FMT, sway_strip_path(__FILE__), __LINE__, ##__VA_ARGS__)