summaryrefslogtreecommitdiffstats
path: root/contrib/inmessage-logger.tengo
blob: 13db04d8914b1c52c0f670ec254185587fb3690f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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()
}