Mercurial > prosody-modules
comparison mod_log_json/README.markdown @ 4462:4356088ad675
mod_log_json: allow logging of formatted message
This is for logging pipelines which can not or do not want to
interpret sprintf-style strings but still need the complete
string for search or whatever.
author | Jonas Schäfer <jonas@wielicki.name> |
---|---|
date | Mon, 22 Feb 2021 16:08:55 +0100 |
parents | bc865568ff02 |
children |
comparison
equal
deleted
inserted
replaced
4461:b9c1216987ae | 4462:4356088ad675 |
---|---|
68 final message. | 68 final message. |
69 | 69 |
70 `args` | 70 `args` |
71 : Array of extra arguments, corresponding to `printf`-style `%s` | 71 : Array of extra arguments, corresponding to `printf`-style `%s` |
72 formatting in the `message`. | 72 formatting in the `message`. |
73 | |
74 Formatted message | |
75 ----------------- | |
76 | |
77 If desired, at the obvious expense of performance, the formatted version of | |
78 the string can be included in the JSON object by specifying the `formatted_as` | |
79 key in the logger config: | |
80 | |
81 ``` {.lua} | |
82 log = { | |
83 -- ... other sinks ... | |
84 { to = "json", formatted_as = "msg_formatted", filename = "/var/log/prosody/prosody.json" }; | |
85 } | |
86 | |
87 ``` | |
88 | |
89 This will expose the formatted message in the JSON as separate `msg_formatted` | |
90 key. It is possible to override existing keys using this (for example, the | |
91 `message` key), but not advisible. |