15 Star 27 Fork 9

Fifi Lyu / zpsoe.zlog

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
BSD-3-Clause

zpsoe.zlog

精简的C++日志库

满足简单需求的日志库,仅有3个头文件和1个源代码文件。无任何第三方库依赖。可直接放到项目中使用。

支持平台:Windows 以及 Linux

1. 关于如何使用,请查看zlog_test/main.cxx。

示例 zlog_test/main.cxx


......
cout << "\n----- TestCase1: 输出到 stdout -----" << endl;
G_LogConfig.level = LOG_TRACE;
G_LogConfig.output_to = LOGOUTPUTSTREAM_STDOUT;

print_log(LOG_TRACE, "TestCase.%d: This is %s log message", 1, "LOG_TRACE");
print_log(LOG_DEBUG, "TestCase.%d: This is %s log message", 1, "LOG_DEBUG");
print_log(LOG_INFO, "TestCase.%d: This is %s log message", 1, "LOG_INFO");
print_log(LOG_WARN, "TestCase.%d: This is %s log message", 1, "LOG_WARN");
print_log(LOG_ERROR, "TestCase.%d: This is %s log message", 1, "LOG_ERROR");
print_log(LOG_FATAL, "TestCase.%d: This is %s log message\n", 1, "LOG_FATAL");
// 不会输出任何日志
print_log(LOG_OFF, "TestCase.%d: This is %s log message", 1, "LOG_OFF");
......

运行结果


####----- TestCase1: 输出到 stdout -----

[2014-10-17 10:30:28] [3039] /home/fifilyu/workspace/zpsoe.zlog/zlog_test/main.cxx:19 TestCase.1: This is LOG_TRACE log message
[2014-10-17 10:30:28] [3039] /home/fifilyu/workspace/zpsoe.zlog/zlog_test/main.cxx:20 TestCase.1: This is LOG_DEBUG log message
[2014-10-17 10:30:28] [3039] TestCase.1: This is LOG_INFO log message
[2014-10-17 10:30:28] [3039] TestCase.1: This is LOG_WARN log message
[2014-10-17 10:30:28] [3039] TestCase.1: This is LOG_ERROR log message
[2014-10-17 10:30:28] [3039] TestCase.1: This is LOG_FATAL log message

2. 编译

mkdir zpsoe.zlog_build
cd zpsoe.zlog_build
cmake ../zpsoe.zlog
make 或者 Visual Studio 编译

Windows平台Release

bin\Release\zlog_test.exe
bin\Release\zpsoe_zlog.dll
lib\Release\zpsoe_zlog.lib
lib\Release\zpsoe_zlogS.lib # 静态库

Linux平台

bin/zlog_test
lib/libzpsoe_zlogS.a # 静态库
lib/libzpsoe_zlog.so

当然,也可以make install,将bin、include以及lib安装到系统默认路径 /usr/local/zpsoe.zlog 或者 C:\Program Files\zpsoe.zlog

Copyright (c) 2014, 淡定的wo All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the {organization} nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

简介

精简的C++日志库 展开 收起
C++ 等 3 种语言
BSD-3-Clause
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
C++
1
https://gitee.com/fifilyu/zpsoe.zlog.git
git@gitee.com:fifilyu/zpsoe.zlog.git
fifilyu
zpsoe.zlog
zpsoe.zlog
master

搜索帮助