English | 简体中文
BqLog is a lightweight, high-performance, industrial-grade logging system that has been widely used in online projects such as "Honor of Kings". BqLog 2.x is officially released! With native
HarmonyOS NEXT,PythonandNode.jssupport, multiple times faster than 1.x, and asymmetric hybrid encryption.
- Python 3.7+ support — Added Python wrapper via CPython C Extension (Stable ABI).
- Package registry publishing — Now available on npm (
npm install @pippocao/bqlog), PyPI (pip install bqlog), Maven Central (Gradle/Maven), and OHPM (ohpm install bqlog). - Python category log generator —
BqLog_CategoryLogGeneratornow generates Python category log wrappers (.py). - TypeScript dual-target generation — Separate outputs for Node.js (
_nodejs.ts) and HarmonyOS (_ohos.ts). - Category log test coverage — Added test suites for Python, Java, C#, and TypeScript.
Full changelog → CHANGELOG.md
- If your client product (especially games) wants to satisfy this "impossible triangle" at the same time:
- Easy troubleshooting (log as much as possible)
- Good performance (log as little as possible)
- Save storage space (better not log at all)
- If you are a backend service developer and your current logging library cannot handle high-concurrency scenarios, causing log loss or application stalls.
- If your programming language is one of C++, Java, C#, Kotlin, TypeScript, JavaScript, Python, or you use multiple languages at the same time and want a unified cross-language logging solution.
- Significant performance advantage over common open-source logging libraries (see Benchmark); suitable for server, client, and mobile.
- Low memory usage: in the Benchmark case (10 threads, 20,000,000 log entries), BqLog itself uses about 1 MB of memory.
- Provides a high-performance, high-compression real-time compressed log format.
- Supports strong hybrid encryption (asymmetric + symmetric) for log content protection with nearly zero performance overhead (optional).
- Works well inside game engines (
Unity,Unreal, etc.), with UE Blueprint and builtin data type support. - Supports
utf8,utf16,utf32characters and strings, as well as bool, float, double, and integer types of various sizes. - Supports
C++20std::formatstyle format strings (without positional index and time formatting). - Asynchronous logging supports crash recovery and tries to avoid data loss.
- On Java, C#, TypeScript wrappers, it can achieve "zero extra heap alloc" (or very close), avoiding continuous object allocations.
- Depends only on the standard C library and platform APIs; can be compiled with Android
ANDROID_STL = none. - Supports
C++11and later standards and works under very strict compiler options. - Build system is based on
CMakeand provides multi-platform scripts, easy to integrate. - Supports custom parameter types.
- Very friendly for code completion and IDE hints.
| Platforms | Languages |
|---|---|
| Windows 64-bit, macOS, Linux (incl. embedded), iOS, Android, HarmonyOS, Unix (FreeBSD, NetBSD, OpenBSD, Solaris, etc.) | C++ (C++11+), Java / Kotlin, C# (Unity, .NET), ArkTS / C++ (HarmonyOS), JavaScript / TypeScript (Node.js), Python 3.7+, Unreal Engine (UE4 & UE5) |
Hardware architectures: x86, x86_64, ARM32, ARM64 Integration methods: Dynamic library, Static library, Source code
Your program accesses the core engine through BqLog Wrapper (C++, Java, C#, TypeScript, Python, etc.). Each Log object can mount one or more Appenders (Console / Text File / Compressed File). Within the same process, Wrappers of different languages can access the same Log object.
| Appender | Output | Readable | Performance | Size | Encryption |
|---|---|---|---|---|---|
| ConsoleAppender | Console | Yes | Low | - | No |
| TextFileAppender | File | Yes | Low | Large | No |
| CompressedFileAppender | File | No | High | Small | Yes |
Before calling any API, you need to integrate BqLog into your project first:
- Standard environments (C++, Java, C#, Python, Node.js, etc.) → Integration Guide
- Game engines (Unity, Tuanjie Engine, Unreal Engine) → Game Engine Integration Guide
#include <string>
#include <bq_log/bq_log.h>
int main() {
std::string config = R"(
appenders_config.appender_console.type=console
appenders_config.appender_console.levels=[all]
)";
auto log = bq::log::create_log("main_log", config);
log.info("Hello BqLog 2.0! int:{}, float:{}", 123, 3.14f);
log.force_flush();
return 0;
}String config = """
appenders_config.console.type=console
appenders_config.console.levels=[all]
""";
bq.log.Log log = bq.log.Log.createLog("java_log", config);
log.info("Hello Java! value: {}", 3.14);string config = @"
appenders_config.console.type=console
appenders_config.console.levels=[all]
";
var log = bq.log.create_log("cs_log", config);
log.info("Hello C#! value:{}", 42);import { bq } from "@pippocao/bqlog";
const config = `
appenders_config.console.type=console
appenders_config.console.levels=[all]
`;
const log = bq.log.create_log("node_log", config);
log.info("Hello from Node.js! params: {}, {}", "text", 123);
bq.log.force_flush_all_logs();from bq.log import log
config = """
appenders_config.console.type=console
appenders_config.console.levels=[all]
"""
my_log = log.create_log("python_log", config)
my_log.info("Hello from Python! params: {}, {}", "text", 123)
log.force_flush_all_logs()import { bq } from "bqlog";
const config = `
appenders_config.console.type=console
appenders_config.console.levels=[all]
`;
const log = bq.log.create_log("ohos_log", config);
log.info("Hello from HarmonyOS! params: {}, {}", "text", 123);
bq.log.force_flush_all_logs();For full integration steps for all platforms, see Integration Guide and Game Engine Integration Guide.
Test: 1–10 threads, each writing 2,000,000 log entries. Environment: i9-13900K, 128 GB, Windows 11.
| 1 Thread | 2 Threads | 3 Threads | 4 Threads | 5 Threads | 6 Threads | 7 Threads | 8 Threads | 9 Threads | 10 Threads | |
|---|---|---|---|---|---|---|---|---|---|---|
| BqLog Compress (C++) | 110 | 125 | 188 | 256 | 318 | 374 | 449 | 511 | 583 | 642 |
| BqLog Text (C++) | 344 | 699 | 1036 | 1401 | 1889 | 2211 | 2701 | 3121 | 3393 | 3561 |
| BqLog Compress (Java) | 129 | 141 | 215 | 292 | 359 | 421 | 507 | 568 | 640 | 702 |
| BqLog Text (Java) | 351 | 702 | 1052 | 1399 | 1942 | 2301 | 2754 | 3229 | 3506 | 3695 |
| Log4j2 Text | 1065 | 2583 | 4249 | 4843 | 5068 | 6195 | 6424 | 7943 | 8794 | 9254 |
| 1 Thread | 2 Threads | 3 Threads | 4 Threads | 5 Threads | 6 Threads | 7 Threads | 8 Threads | 9 Threads | 10 Threads | |
|---|---|---|---|---|---|---|---|---|---|---|
| BqLog Compress (C++) | 97 | 101 | 155 | 228 | 290 | 341 | 415 | 476 | 541 | 601 |
| BqLog Text (C++) | 153 | 351 | 468 | 699 | 916 | 1098 | 1212 | 1498 | 1733 | 1908 |
| BqLog Compress (Java) | 109 | 111 | 178 | 240 | 321 | 378 | 449 | 525 | 592 | 670 |
| BqLog Text (Java) | 167 | 354 | 491 | 718 | 951 | 1139 | 1278 | 1550 | 1802 | 1985 |
| Log4j2 Text | 3204 | 6489 | 7702 | 8485 | 9640 | 10458 | 11483 | 12853 | 13995 | 14633 |
- TextFileAppender: BqLog has about 3x performance advantage over Log4j2
- CompressedFileAppender: BqLog has about 10x+ performance advantage over Log4j2
- Compared with BqLog 1.5, 2.x average performance improved by about 40%
For full benchmark code and methodology, see Benchmark.
- Added HarmonyOS support, including ArkTS and C++.
- Added Node.js support (CJS and ESM).
- Improved cross-platform compatibility, stability and generality; supports more Unix systems.
- Average performance improved by ~80% for UTF-8, and by >500% for UTF-16 environments (C#, Unreal, Unity).
- Android no longer must be used together with Java.
- Removed the
is_in_sandboxconfig and replaced it withbase_dir_type; added filters for snapshots and support for opening a new log file on each startup. See Configuration. - Added high-performance hybrid asymmetric encryption, almost zero overhead; see Advanced Usage — Encryption.
- Provides Unity, Tuanjie Engine, and Unreal Engine plugins, making it easy to use in game engines; provides ConsoleAppender redirection to game-engine editors and Blueprint support for Unreal. See Game Engine Integration Guide.
- The repository no longer ships binaries. From 2.x on, please download platform- and language-specific packages from the Releases page.
- The size of a single log entry is not limited by
log.buffer_sizeanymore; - The timezone can be specified manually.
- The
raw_fileappender is deprecated and no longer maintained in 2.x; please use thecompressed_fileappender instead. - The Recovery feature's reliability has been improved and it has been promoted from experimental (beta) to stable (release). see Advanced Usage — Data Protection.
| Document | Description |
|---|---|
| Integration Guide | Full integration steps for all platforms + all language demos |
| Game Engine Integration | Unity, Tuanjie Engine, Unreal Engine plugins and Blueprint usage |
| API Reference | Core APIs, sync/async logging, Appender overview, build & tools |
| Configuration | Full configuration reference (appenders, log, snapshot) |
| Advanced Usage | No Heap Alloc, Category, crash recovery, custom types, encryption |
| Benchmark | Full benchmark code (C++, Java, Log4j) and results |
If you want to contribute code, please make sure your changes can pass the following workflows under GitHub Actions in the repository:
AutoTestBuild
It is recommended to run corresponding scripts locally before submitting to ensure both testing and building pass normally.