1 unstable release

0.1.0 Jan 18, 2024

#978 in Encoding




Library for flexible configuration of tarantool logs. Allows you to set your own log format or choose from builtin formats. Supports "data injectors" for enrichment log records with any data (e.g. instance-id or request-id). All formats are applying to tarantool internal logs as well.

Builtin formats

  • JsonRaw - json logs. This format is as close as possible to an original tarantool 'json' format.
  • Json - json logs, use serde library for a log record generation.
  • Plain - plain text. This format is as close as possible to an original tarantool 'plain' format.

Also, you can implement your own format.


generate file size (lines per sec)
bigger is better
generated stdout output (mb per sec)
bigger is better
tarantool-json 144135 49,675
tarolog-json 203785 82
tarolog-json-serde 188217 70,25
tarantool-plain 210876 29,475
tarolog-plain 231691 29,95

See a "bench" package for familiarize with benchmark process.


In this example we use json format with injectors that propagate two fields:

  • key: "additional data", value: true
  • key: "request_id", value: {request id extracted from fiber local storage}
use tarolog;
use tarolog::Format;
use tarantool;
use tarantool::ffi;
use std::collections::HashMap;
use log::info;

fn main() {
    tarolog::set_default_logger_format(Format::Json(Some(|| {
        let mut additional_info =
            HashMap::from([("additional data".to_string(), serde_json::Value::Bool(true))]);
        // lua available only in tx thread, check it
        let cord_is_main = unsafe { ffi::tarantool::cord_is_main() };
        if cord_is_main {
            let lua = tarantool::lua_state();
            if let Ok(Some(rid)) = lua.eval("return require('fiber').self().storage['rid']") {
                additional_info.insert("request_id".to_string(), serde_json::Value::String(rid));

    info!("now new format is installed");


tarantool-test is required.

Run unit tests

cargo test

Run integration tests

cargo build; tarantool-test -p ./target/debug/libtests.so -- -i tests/test_init.lua

All tests

make test


~212K SLoC