aboutsummaryrefslogtreecommitdiffstats
path: root/lclipd.lua
diff options
context:
space:
mode:
authorterminaldweller <devi@terminaldweller.com>2023-03-19 10:58:15 +0000
committerterminaldweller <devi@terminaldweller.com>2023-03-19 10:58:15 +0000
commit7396f80d1a244273c83aee4a750b3fc1eb842e5d (patch)
treebd00438882f95f7fc233f95910ae950390650faf /lclipd.lua
parentnow using proper string replacement (diff)
downloadlclip-sqlite3.tar.gz
lclip-sqlite3.zip
added function names to the logssqlite3
Diffstat (limited to 'lclipd.lua')
-rwxr-xr-xlclipd.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/lclipd.lua b/lclipd.lua
index cd7ab61..a58a3da 100755
--- a/lclipd.lua
+++ b/lclipd.lua
@@ -110,11 +110,14 @@ parser:option("-s --hist_size", "history file size", 200)
--- Log the given string to syslog with the given priority.
-- @param log_str the string passed to the logging facility
-- @param log_priority the priority of the log string
+-- functions called through pcall will return nil when we
+-- try to get their name from debug.getinfo
local function log_to_syslog(log_str, log_priority)
+ local caller_name = debug.getinfo(2, "n").name
posix_syslog.openlog("clipd",
posix_syslog.LOG_NDELAY | posix_syslog.LOG_PID,
posix_syslog.LOG_LOCAL0)
- posix_syslog.syslog(log_priority, log_str)
+ posix_syslog.syslog(log_priority, tostring(caller_name) .. ": " .. log_str)
posix_syslog.closelog()
end