mpacklog.cpp v3.2.0
Loading...
Searching...
No Matches
mpacklog.cpp

Build Documentation Coverage C++ versions Release

Log dictionaries to MessagePack files in C++.

Installation

Add a git repository rule to your Bazel WORKSPACE:

load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
http_archive(
name = "mpacklog",
sha256 = "d9931db7fff526f6eae1421e0b12eef7e153b43722191d85e79fe85c9438b3ec",
strip_prefix = "mpacklog.cpp-3.2.0",
url = "https://github.com/stephane-caron/mpacklog.cpp/archive/refs/tags/v3.2.0.tar.gz",
)
load("@mpacklog//tools/workspace:default.bzl", add_mpacklog_repositories = "add_default_repositories")
# This adds dependencies such as @palimpsest for building mpacklog targets
add_mpacklog_repositories()

You can then use the @mpacklog dependency in your C++ targets.

Usage

The library is multi-threaded. Add messages to the log using the put function, they will be written to file in the background.

#include <palimpsest/Dictionary.h>
int main() {
mpacklog::Logger logger("output.mpack");
palimpsest::Dictionary dict;
dict("something") = "foo";
for (unsigned bar = 0; bar < 1000u; ++bar) {
dict("bar") = bar;
logger.put(dict):
}
}
Multi-threaded logger.
Definition Logger.h:54

See also

  • jq: manipulate JSON series to add, remove or extend fields.
  • mpacklog.py: Sibling Python project with an mpacklog command-line tool to manipulate MessagePack files.
  • rq: transform from/to MessagePack, JSON, YAML, TOML, ...