Viewing file on branch master
| / | contrib | inmessage-logger.tengo |
| 1 | fmt := import("fmt") |
| 2 | os := import("os") |
| 3 | times := import("times") |
| 4 | |
| 5 | if msgText != "" && msgUsername != "system" { |
| 6 | os.chdir("/var/www/matterbridge") |
| 7 | file := os.open_file("inmessage.log", os.o_append|os.o_wronly|os.o_create, 0644) |
| 8 | file.write_string(fmt.sprintf( |
| 9 | "[%s] <%s> %s\n", |
| 10 | times.time_format(times.now(), times.format_rfc1123), |
| 11 | msgUsername, |
| 12 | msgText |
| 13 | )) |
| 14 | file.close() |
| 15 | } |
| 16 |