Commit Graph

29 Commits

Author SHA1 Message Date
Simon Ser
fc640d5f6c Define _POSIX_C_SOURCE globally
See discussion in https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4555
2024-02-23 17:43:19 +03:00
Simon Ser
1dbb699036
common/log: write log importance
When colors aren't used, write the log importance to stderr. This makes
it easier to grep for errors and avoids mistaking error messages for
debug messages.

This is [1] ported to Sway.

[1]: https://github.com/swaywm/wlroots/pull/2149
2020-12-10 09:26:02 +01:00
Tudor Brindus
c632d47bf8 common/log: use bright black rather than black for SWAY_DEBUG
On some terminals under default settings, black is truly rendered as
`#000`, making it unreadable when the background is also black.

Closes #5141.
2020-05-24 14:54:05 +02:00
Jan Beich
fafc060909 common/log: bump POSIX version used after e81d9fde66
../common/log.c:63:16: error: use of undeclared identifier 'CLOCK_MONOTONIC'
        clock_gettime(CLOCK_MONOTONIC, &start_time);
                      ^
../common/log.c:75:16: error: use of undeclared identifier 'CLOCK_MONOTONIC'
        clock_gettime(CLOCK_MONOTONIC, &ts);
                      ^
2020-03-07 12:05:51 +01:00
Simon Ser
e81d9fde66 common/log: improve time prefix
Same as [1].

[1]: https://github.com/swaywm/wlroots/pull/2052
2020-03-07 00:35:35 +01:00
Manuel Stoeckl
2dc4978d8a Use -fmacro-prefix-map to strip build path
Because meson does not provide a simple way to get the relative build
path, it is computed with a pair of foreach loops. As meson does not
have a simple way to compute string length (except via underscorify
and 63 split operations), the build script uses a shell command
instead.

If the compiler does not suppot -fmacro-prefix-map, then fall back
to passing in the relative path prefix, and use its length to offset
the uses of __FILE__ in log messages so that the build path is at
least still not included in the logs. This is significantly more
efficient than calling _sway_strip_path.
2019-07-15 16:35:50 -04:00
M Stoeckl
1211a81aad Replace wlr_log with sway_log
This commit mostly duplicates the wlr_log functions, although
with a sway_* prefix. (This is very similar to PR #2009.)
However, the logging function no longer needs to be replaceable,
so sway_log_init's second argument is used to set the exit
callback for sway_abort.

wlr_log_init is still invoked in sway/main.c

This commit makes it easier to remove the wlroots dependency for
the helper programs swaymsg, swaybg, swaybar, and swaynag.
2019-01-21 12:59:42 +01:00
emersion
63b4bf5000
Update for swaywm/wlroots#1126 2018-07-09 22:54:30 +01:00
Dominique Martinet
d4ddfec32e common/log: finish removing most log functions
Keep sway_abort and sway_assert and convert them to use wlr_log
functions
2018-01-05 23:40:09 +01:00
Drew DeVault
733993a651 Move everything to sway/old/ 2017-11-18 11:22:02 -05:00
Calvin Lee
016261fd64 Print log level even if STDERR is not a tty
Makes reading debug logs much easier, debug lines will start with `E`,
info lines with `I` and error lines with `E`.
2017-10-20 15:12:28 -06:00
johalun
7fef283044 FreeBSD fixes
Increase _POSIX_SOURCE value where needed.
Increase _XOPEN_SOURCE value where needed.
Conditionally link to libcap (only on Linux).
Possibly some trailing whitespace fixes (automatic).
2017-06-06 09:45:50 +02:00
Jerzi Kaminsky
8ecb490679 Make sway_abort() report location 2017-04-20 19:20:40 +03:00
Jerzi Kaminsky
709b53bd43 Fix location reported by sway_assert 2017-04-16 16:39:53 +03:00
Jerzi Kaminsky
eb3b1ec5f1 Fix variadic forwarding in sway_assert
_sway_assert is a variadic function which tries
to delegate to another variadic function. This
requires a vprintf-style variant of the delegate.

https://stackoverflow.com/a/150616
2017-04-16 16:39:53 +03:00
Drew DeVault
9aed9d9359 UnGNUify the codebase 2017-03-10 23:41:24 -05:00
Drew DeVault
9ad1e6b40f Handle malloc failure in ipc_recv_response 2016-12-15 19:01:40 -05:00
Drew DeVault
416417a54c Reorganize includes 2016-09-01 08:18:37 -04:00
Tony Crisci
70360c5c07 Add timestamp to log messages 2016-07-28 22:15:14 -04:00
Drew DeVault
c8917395c0 Remove SIGSERV and SIGABORT handler
From now on let's just let the core dumps happen and ask users to
provide them.
2016-07-17 11:29:29 -04:00
David Eklov
26842ff383 Add get_log_level() to encapsulate v (current log level)
This patch also makes all global variable in log.c static.
2016-06-27 18:56:50 -05:00
Eric Engestrom
cc9d1cacbb common: refactor sway_log()
This removes most preprocessor logic, leaving it only it the header.
2016-05-02 18:30:04 +01:00
Eric Engestrom
f53ddbe800 common: fix double-close in error_handler() 2016-05-02 15:58:32 +01:00
Eric Engestrom
a1bb58017b Fix off-by-one bug in log functions 2016-05-02 12:04:14 +01:00
Mikkel Oscar Lyderik
5e253fdd9a Correctly exit sway on errors.
Calling `exit` in sway_terminate prevents sway from correctly shutting
down (freeing data, cleanly terminating the ipc server, etc.).

A better way is to exit straight away if the failure occurs before
`wlc_run` and use sway_abort as usual if it occur when wlc is running.
2016-02-26 09:42:21 +01:00
Mikkel Oscar Lyderik
bacd40d6db Fix clang warnings 2016-02-08 12:30:42 +01:00
Drew DeVault
e5bb08cc18 Print /proc/<pid>/maps on segfault 2016-01-28 07:57:07 -05:00
robotanarchy
94cac7a014 use CMake's FindBacktrace for backtrace feature detection 2015-12-21 19:01:17 +01:00
Drew DeVault
bfcabe48ef Start fleshing out wayland client implementation
This introduces a basic shared framework for making wayland clients
within sway itself.
2015-11-12 19:04:01 -05:00