游戏开发日志库
一、源码
二、模板配置
{ "asyn" : true, // support multi-thread "filter" : { "debug" : false, "err" : false, "info" : false, "perf" : false }, "logger" : [ { "name" : "", "type" : 0 }, { "name" : "debug.log", "type" : 1 }, { "name" : "info.log", "type" : 2 }, { "name" : "err.log", "type" : 3 }, { "name" : "perf.log", "type" : 4 } ], "tag" : [ "core", "pathfinder", "lua" ] }
三、示例
interface_logmgr* logger = load_module_log(); logger->init("log_template.config"); logger->logf(ELT_DEBUG, "core", "%s", "debug color"); logger->logf(ELT_INFO, "core", "%s", "info color"); logger->logf(ELT_ERROR, "core", "%s", "error color"); logger->logf(ELT_PERF, "core", "%s", "per color"); unload_module_log(logger);
四、跨平台部署
1. get build project
git clone https://github.com/SuperCLine/cmake_cline.git
2. get core project
cd cmake_cline git clone https://github.com/SuperCLine/core.git
3. get log project
git clone https://github.com/SuperCLine/log.git
4. get external jsoncpp
git submodule update --init --recursive
Build On Centos
sh Build.sh
Build On Windows
using cmake gui and visual studio 2017
Installation Requirements
1. upgrade gcc to 7.3 to support c++ 17
yum -y install centos-release-scl yum -y install devtoolset-7-gcc devtoolset-7-gcc-c++ devtoolset-7-binutils scl enable devtoolset-7 bash
2. CMAKE 3.15.0
wget https://cmake.org/files/v3.15/cmake-3.15.0.tar.gz tar xzvf cmake-3.15.0.tar.gz cd cmake-3.15.0 ./bootstrap gmake make install cmake --version hash -r cmake --version