/* * Log4z License * ----------- * * Log4z is licensed under the terms of the MIT license reproduced below. * This means that Log4z is free software and can be used for both academic * and commercial purposes at absolutely no cost. * * * =============================================================================== * * Copyright (C) 2010-2015 YaweiZhang . * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * * =============================================================================== * * (end of COPYRIGHT) */ /* * AUTHORS: YaweiZhang * VERSION: 3.0.0 * PURPOSE: A lightweight library for error reporting and logging to file and screen . * CREATION: 2010.10.4 * LCHANGE: 2014.12.19 * LICENSE: Expat/MIT License, See Copyright Notice at the begin of this file. */ /* * contact me: * tencent qq group: 19811947 * mail: yawei.zhang@foxmail.com */ /* * UPDATES LOG * * VERSION 0.1.0 * create the first project. * It support put log to screen and files, * support log level, support one day one log file. * support multi-thread, cross-platform. * * VERSION .... * ... * * VERSION 0.9.0 * support config files. * support color text in screen. * support multiple output to different files. * * VERSION 1.0.0 * support comments in the config file. * add a advanced demo in the ./project * fix some details. * * VERSION 1.0.1 * change and add some Comments in the log4z * simplify the 'fast_test' demo projects. * * VERSION 1.1.0 * the method Start will wait for the logger thread started. * config and add method change. * namespace change. * * VERSION 1.1.1 * add status info method. * optimize. * * VERSION 1.2.0 * add stress test demo * rewrite Stream module,better performance. * * VERSION 1.2.1 * fixed type name 'long' stream format on 64/32 operation system. * logger will not loss any log on process normal exit. * * VERSION 2.0.0 * new interface: * merge some Main interface and Dynamic interface * add Change Logger Attribute method by thread-safe * new config design. * log file name append process id. * * VERSION 2.1 * support binary text output * rewrite write file module, support vs2005 open Chinese characters path * * VERSION 2.2 * optimized binary stream output view * support wchar * string. * * VERSION 2.3 * adjust output file named. * support different month different directory. * adjust some detail. * * VERSION 2.4 * support rolling log file. * support hot update configure * used precision time in log. * micro set default logger attribute * fix tls bug in windows xp dll * * VERSION 2.5 * screen output can choice synchronous or not * fix sometimes color will disorder on windows. * eliminate some compiler warning * fix sem_timewait in linux * add format-style method at input log, cannot support vs2003 and VC6. * fix WCHAR String cannot output * optimize std::string, binary log input, and support std::wstring. * clean code, better readability * * VERSION 2.6 * add PrePushLog * better performance when log is filter out. * interface replace std::string because it's in shared library is unsafe. * add log level 'trace' * * VERSION 2.6.1 * fix bug from defined _MSC_VER * * VERSION 2.7 * compatible mac machine, now log4z can working in linux/windows/mac. * * VERSION 2.8 * support synchronous written to file and thread-safe * fix compatibility on MinGW. a constant value suffix. * ignore utf-8 file BOM when load configure file * use macro WIN32_LEAN_AND_MEAN replace head file winsock2.h * new naming notations * * VERSION 3.0 * new naming notations * support for reading config from a string. * remove all TLS code, used dispatch_semaphore in apple OS. * support system: windows, linux, mac, iOS * */ #pragma once #include #include ////////////////////////////////////////////////////////////////////////// //! -----------------default logger config, can change on this.----------- ////////////////////////////////////////////////////////////////////////// //! the max logger count. const int LOG4Z_LOGGER_MAX = 10; //! default logger output file. const char* const LOG4Z_DEFAULT_PATH = "./log/"; //! default log filter level const int LOG4Z_DEFAULT_LEVEL = SOUI::ILog4zManager::LOG_LEVEL_DEBUG; //! default logger display const bool LOG4Z_DEFAULT_DISPLAY = true; //! default logger output to file const bool LOG4Z_DEFAULT_OUTFILE = true; //! default logger output file limit size, unit M byte. const int LOG4Z_DEFAULT_LIMITSIZE = 100; //! default logger show suffix (file name and line number) const bool LOG4Z_DEFAULT_SHOWSUFFIX = true; /////////////////////////////////////////////////////////////////////////// //! ----------------------------------------------------------------------- ////////////////////////////////////////////////////////////////////////// namespace SOUI { namespace LOG4Z { SOUI_COM_C BOOL SOUI_COM_API SCreateInstance(IObjRef **ppLogMgr); } }