diff options
author | jan Anja <cyber@sysrq.in> | 2022-03-12 03:31:45 +0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-11 23:31:45 +0100 |
commit | 0dbbd0414cbd69a8afd79ba47740a8e17be6da89 (patch) | |
tree | b3652e929ce2cb689826a5ca759c2d72069578c4 | |
parent | e7b3ebf98aad0277f6679fb5d44a9e6740ab11a4 (diff) | |
download | matterbridge-msglm-0dbbd0414cbd69a8afd79ba47740a8e17be6da89.tar.gz matterbridge-msglm-0dbbd0414cbd69a8afd79ba47740a8e17be6da89.tar.bz2 matterbridge-msglm-0dbbd0414cbd69a8afd79ba47740a8e17be6da89.zip |
Create inmessage-logger.tengo (#1688) (#1747)
-rw-r--r-- | contrib/inmessage-logger.tengo | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/contrib/inmessage-logger.tengo b/contrib/inmessage-logger.tengo new file mode 100644 index 00000000..13db04d8 --- /dev/null +++ b/contrib/inmessage-logger.tengo @@ -0,0 +1,15 @@ +fmt := import("fmt") +os := import("os") +times := import("times") + +if msgText != "" && msgUsername != "system" { + os.chdir("/var/www/matterbridge") + file := os.open_file("inmessage.log", os.o_append|os.o_wronly|os.o_create, 0644) + file.write_string(fmt.sprintf( + "[%s] <%s> %s\n", + times.time_format(times.now(), times.format_rfc1123), + msgUsername, + msgText + )) + file.close() +} |