Skip to content

Increase verbosity for logging errors from C #10116

@nshy

Description

@nshy

In scope of #9105 we increase verbosity of error serialization. As a result we got verbose error logging too:

local compat = require('compat')
local log = require('log')

local e1 = box.error.new(0)
local e2 = box.error.new(0)
e2:set_prev(e1)
compat.box_error_serialize_verbose = 'new'
log.cfg{level = 'error'}
log.error(e2)

Produces:

$ ./build-dev/src/tarantool test.lua
2024-06-07 19:03:29.212 [3822235] main/104/test.lua/test test.lua:9 E> Unknown error {"name":"UNKNOWN","code":0,"base_type":"ClientError","type":"ClientError","trace":[{"file":"test.lua","line":4}]}
Unknown error {"name":"UNKNOWN","code":0,"base_type":"ClientError","type":"ClientError","trace":[{"file":"test.lua","line":5}]}

But when we log error from C we get no verbosity:

local compat = require('compat')

box.cfg{log_level = 'error'}
local test = box.schema.create_space('test')
compat.box_error_serialize_verbose = 'new'
test:create_index('pk')
test:insert({1, 2})
test:upsert({1, 2}, {{'+', 1, 1}})

Produces:

$ ./build-dev/src/tarantool test.lua
2024-06-07 19:04:26.052 [3822269] main/104/test.lua memtx_space.c:658 E> ER_CANT_UPDATE_PRIMARY_KEY: Attempt to modify a tuple field which is part of primary index in space 'test'

Metadata

Metadata

Assignees

Labels

featureA new functionality

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions