Comparison

mod_log_json/mod_log_json.lua @ 3733:9a3d25311fd9

mod_log_json: Use filename from logging config
author Kim Alvefur <zash@zash.se>
date Sun, 03 Nov 2019 14:33:01 +0100
parent 3732:21cfbdaac767
child 3734:b8bd79c57040
comparison
equal deleted inserted replaced
3732:21cfbdaac767 3733:9a3d25311fd9
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("blah.json", "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