Skip to content
Snippets Groups Projects
Commit 85ef1118 authored by Ilya Verbin's avatar Ilya Verbin Committed by Vladimir Davydov
Browse files

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.
parent 84306671
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment