log: improve logging of tables
1. Fixed modification of a variable passed to the logging function (both log formats) tarantool> a = {foo = 'bar', file = 'c://autorun.bat'} tarantool> log.info(a) [...] tarantool> a (before) - foo: bar (after) - foo: bar file: c://autorun.bat 2. Fixed the drop of fields with reserved internal names (plain log format) tarantool> log.info({foo = 'bar', pid = 666}) (before) {"foo":"bar"} (after) {"foo":"bar","pid":666} 3. Now if 'message' field is absent, it is set to the first field of the table (JSON log format) tarantool> log.info({'Hello, world', key = 'value'}) (before) {[...], "1":"Hello, world", "key":"value", [...]} (after) {[...], "message":"Hello, world", "key":"value", [...]} 4. Fixed assertion on a table without string keys (JSON log format) If a Lua table, passed to say(), contains only integer indexes, json.encode() will encode it as an array rather than a map, thereafter say_format_json() will produce improperly formatted JSON string, or get assertion failure. Fix it by encoding all kinds of tables as maps. Closes #3853 Closes #7955 NO_DOC=Mostly bug fixes, the format of the JSON log is not documented.
Loading
Please register or sign in to comment