diff options
author | Anton Khirnov <anton@khirnov.net> | 2023-01-05 16:14:52 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2023-01-05 16:14:52 +0100 |
commit | d2fbf3c11fb10c2b76455df2a718a8c8d88bf16d (patch) | |
tree | ddac900d5c993625d2d7ecffbb37635f39a64609 /utils.lua | |
parent | 8a99126930b902171204fd7e1c5871014ebffa33 (diff) |
utils: add logging functions
Diffstat (limited to 'utils.lua')
-rw-r--r-- | utils.lua | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -146,4 +146,20 @@ function M.notify_singleton(wsp, id, args) wsp.notify_tbl[id] = naughty.notify(args) end +function M.log(component, msg, ...) + local prefix = string.format('[awesome/%s] ', component) + local str = string.format(msg, ...) + + print(prefix .. str) + + return prefix, str +end + +function M.warn(component, msg, ...) + local prefix, str = M.log(component, msg, ...) + naughty.notify({ preset = naughty.config.presets.critical, + title = prefix, + text = str }) +end + return M |