BqLog is a lightweight and high-performance logging system that has found success in various projects, including popular games like ‘Honor of Kings.’ In this article, we’ll walk you through the process of integrating BqLog into your project seamlessly, using analogous examples to simplify complex coding concepts, while also offering troubleshooting tips along the way.
Supported Platforms and Languages
- **Platforms**: Windows (64-bit), MacOS, Linux, iOS, Android (X86_64, arm64-v8a, armeabi-v7a), and Unix (passed the test on FreeBSD).
- **Languages**: C++, Java, Kotlin, and C#.
Features of BqLog
BqLog’s performance is its strong suit, offering low memory consumption even when logging massive amounts of data. For example, in a benchmark with 10 threads and 20 million log entries, BqLog consumed less than 1 MB of memory. Here’s a quick rundown of its features:
- High-performance and high-compression real-time log format.
- Compatibility with mobile devices and gaming engines like Unity and Unreal.
- Support for various string encodings and parameter types.
- Asynchronous logging with crash review to prevent data loss.
- Less than 200 KB for dynamic libraries post-compilation on Android.
Integrating BqLog into Your Project
Now, let’s explore how you can integrate BqLog into your project, considering both C++ and C# environments. Think of this like assembling a LEGO set: every piece has its designated place to help you build the final masterpiece.
1. C++ Integration
For C++ projects, BqLog can be added as a dynamic library, a static library, or directly as source code. Here’s a step-by-step analogy:
Dynamic Library
- Imagine picking a pre-assembled LEGO piece from a box (the dynamic library file).
- Select the appropriate file for your platform and put it into the build system.
- Ensure to drop the corresponding header files into your project (just like getting a user manual with the set).
Static Library
- Similar to picking another type of LEGO piece that doesn’t need supporting materials for construction.
- Follow the steps above but with static library files instead.
Source Code
- For this option, copy the source code folder into your project as if you’re adding your own custom pieces to build your design.
- Don’t forget to set your compiler options accurately, much like ensuring you’ve got the right tools in your toolbox.
2. C# Integration
Using BqLog in C# involves similar steps. Here’s how:
- Select the dynamic library file for your platform and add it to your project like adding a special LEGO piece to your construction.
- Copy the necessary C# wrapper files from `wrapper/csharp/src` (equivalent to getting the assembly instructions for those special pieces).
Sample Demo Code
To demonstrate logging using BqLog, here’s a simple snippet that outputs over 1,000 logs to your console. This can be visualized as sending a flurry of messages like throwing multiple paper planes, with each plane representing a log:
#include <bq_log/bq_log.h>
int main() {
std::string config = R(
appenders_config.appender_0.type=console;
appenders_config.appender_0.levels=[verbose,debug,info,warning,error,fatal];
);
bq::log log = bq::log::create_log(myFirstLog, config);
for (int i = 0; i < 1024; ++i) {
log.info("This is an info message #{i}");
}
bq::log::force_flush_all_logs();
return 0;
}
Troubleshooting Tips
Sometimes, things might not go as planned. Here are some troubleshooting ideas to consider:
- **Ensure you have the right library files**: Double-check that you have the correct architecture for your platform.
- **Memory consumption**: If you notice abnormal memory use, ensure your application is configured correctly to manage threads and logging frequency.
- **Log Visibility**: If logs do not appear, make sure your configuration settings allow for logging at the desired levels.
- **For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.**
Conclusion
Integrating BqLog into your project enhances your logging capabilities significantly. The steps outlined and analogies provided aim to simplify complex concepts and foster greater understanding. As a bonus, remember to flush your logs to ensure all messages are captured correctly.
At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

