diff options
-rw-r--r-- | common/log.c | 15 | ||||
-rw-r--r-- | sway/handlers.c | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/common/log.c b/common/log.c index 6f9fb07e..1da2ba2f 100644 --- a/common/log.c +++ b/common/log.c @@ -8,6 +8,7 @@ #include <fcntl.h> #include <unistd.h> #include <signal.h> +#include <time.h> #include <errno.h> #include <string.h> #include <stringop.h> @@ -65,6 +66,20 @@ void sway_abort(const char *format, ...) { void _sway_log(const char *filename, int line, log_importance_t verbosity, const char* format, ...) { if (verbosity <= v) { + // prefix the time to the log message + static struct tm result; + static time_t t; + static struct tm *tm_info; + char buffer[26]; + + // get current time + t = time(NULL); + // convert time to local time (determined by the locale) + tm_info = localtime_r(&t, &result); + // generate time prefix + strftime(buffer, sizeof(buffer), "%x %X - ", tm_info); + fprintf(stderr, "%s", buffer); + unsigned int c = verbosity; if (c > sizeof(verbosity_colors) / sizeof(char *) - 1) { c = sizeof(verbosity_colors) / sizeof(char *) - 1; diff --git a/sway/handlers.c b/sway/handlers.c index 7e958c72..cb608bec 100644 --- a/sway/handlers.c +++ b/sway/handlers.c @@ -270,6 +270,7 @@ static bool handle_view_created(wlc_handle handle) { wlc_view_set_mask(handle, VISIBLE); wlc_view_set_output(handle, panel_config->output); wlc_view_bring_to_front(handle); + arrange_windows(&root_container, -1, -1); return true; } |