Software /
code /
prosody-modules
Comparison
mod_log_json/mod_log_json.lua @ 3734:b8bd79c57040
mod_log_json: Open file in read+append mode
Dunno why but this is what core.loggingmanager does
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 03 Nov 2019 14:33:03 +0100 |
parent | 3733:9a3d25311fd9 |
child | 3746:bc865568ff02 |
comparison
equal
deleted
inserted
replaced
3733:9a3d25311fd9 | 3734:b8bd79c57040 |
---|---|
4 local datetime = require "util.datetime".datetime; | 4 local datetime = require "util.datetime".datetime; |
5 | 5 |
6 module:set_global(); | 6 module:set_global(); |
7 | 7 |
8 local function sink_maker(config) | 8 local function sink_maker(config) |
9 local logfile = io.open(config.filename, "a"); | 9 local logfile = io.open(config.filename, "a+"); |
10 logfile:setvbuf("no"); | 10 logfile:setvbuf("no"); |
11 return function (source, level, message, ...) | 11 return function (source, level, message, ...) |
12 local args = pack(...); | 12 local args = pack(...); |
13 for i = 1, args.n do | 13 for i = 1, args.n do |
14 if args[i] == nil then | 14 if args[i] == nil then |