Software /
code /
prosody
Comparison
plugins/mod_scansion_record.lua @ 11254:613035d6e5a0
mod_scansion_record: Flush after writes
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 08 Jan 2021 07:43:07 +0000 |
parent | 10718:d229e4d31598 |
child | 12110:b5b799a2a10c |
comparison
equal
deleted
inserted
replaced
11253:919e7b962f0b | 11254:613035d6e5a0 |
---|---|
16 local head = io.open(header_file, "w"); | 16 local head = io.open(header_file, "w"); |
17 local scan = io.open(record_file, "w+"); | 17 local scan = io.open(record_file, "w+"); |
18 | 18 |
19 local function record(string) | 19 local function record(string) |
20 scan:write(string); | 20 scan:write(string); |
21 scan:flush(); | |
21 end | 22 end |
22 | 23 |
23 local function record_header(string) | 24 local function record_header(string) |
24 head:write(string); | 25 head:write(string); |
26 head:flush(); | |
25 end | 27 end |
26 | 28 |
27 local function record_object(class, name, props) | 29 local function record_object(class, name, props) |
28 head:write(("[%s] %s\n"):format(class, name)); | 30 head:write(("[%s] %s\n"):format(class, name)); |
29 for k,v in pairs(props) do | 31 for k,v in pairs(props) do |
30 head:write(("\t%s: %s\n"):format(k, v)); | 32 head:write(("\t%s: %s\n"):format(k, v)); |
31 end | 33 end |
32 head:write("\n"); | 34 head:write("\n"); |
35 head:flush(); | |
33 end | 36 end |
34 | 37 |
35 local function record_event(session, event) | 38 local function record_event(session, event) |
36 record(session.scansion_id.." "..event.."\n\n"); | 39 record(session.scansion_id.." "..event.."\n\n"); |
37 end | 40 end |