blob: 54fc3173ef2f626731dd9dd12d67be04d47e401d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
local n = require("naughty").notification
local gdebug = require "gears.debug"
---@class QuarrelDebug
local M = {}
--- Send a notification with the specified message
---@param message any
function M.debug(message)
if type(message) == "table" then
gdebug.dump(message, "data", 8)
n { message = "Dumped table!", app_name = "QDebug", level = "debug" }
else
n { message = tostring(message), app_name = "QDebug", level = "debug" }
end
end
--- Print an info message to stdout and send a notification at the same time
---@param message any
function M.info(message)
print("[QDebug]: " .. tostring(message))
n { message = message, app_name = "QDebug", level = "info" }
end
--- Print a warning to stderr and send a notification at the same time
---@param message any
function M.warn(message)
gdebug.print_warning("[QDebug]: " .. tostring(message))
n { message = message, app_name = "QDebug", level = "warn" }
end
--- Print an error to stderr and send a notification at the same time
---@param message any
function M.error(message)
gdebug.print_warning("[QDebug]: " .. tostring(message))
n { message = message, app_name = "QDebug", level = "error" }
end
return M
|