You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
202 lines
6.5 KiB
202 lines
6.5 KiB
/*
|
|
* 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 <yawei.zhang@foxmail.com>.
|
|
*
|
|
* 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 <yawei.zhang@foxmail.com>
|
|
* 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 <DATE: 2010.10.4>
|
|
* 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 .... <DATE: ...>
|
|
* ...
|
|
*
|
|
* VERSION 0.9.0 <DATE: 2012.12.24>
|
|
* support config files.
|
|
* support color text in screen.
|
|
* support multiple output to different files.
|
|
*
|
|
* VERSION 1.0.0 <DATE: 2012.12.29>
|
|
* support comments in the config file.
|
|
* add a advanced demo in the ./project
|
|
* fix some details.
|
|
*
|
|
* VERSION 1.0.1 <DATE: 2013.01.01>
|
|
* change and add some Comments in the log4z
|
|
* simplify the 'fast_test' demo projects.
|
|
*
|
|
* VERSION 1.1.0 <DATE: 2013.01.24>
|
|
* the method Start will wait for the logger thread started.
|
|
* config and add method change.
|
|
* namespace change.
|
|
*
|
|
* VERSION 1.1.1 <DATE: 2013.02.23>
|
|
* add status info method.
|
|
* optimize.
|
|
*
|
|
* VERSION 1.2.0 <DATE: 2013.04.05>
|
|
* add stress test demo
|
|
* rewrite Stream module,better performance.
|
|
*
|
|
* VERSION 1.2.1 <DATE: 2013.04.13>
|
|
* 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 <DATE: 2013.04.25>
|
|
* 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 <DATE: 2013.05.22>
|
|
* support binary text output
|
|
* rewrite write file module, support vs2005 open Chinese characters path
|
|
*
|
|
* VERSION 2.2 <DATE: 2013.07.08>
|
|
* optimized binary stream output view
|
|
* support wchar * string.
|
|
*
|
|
* VERSION 2.3 <DATE: 2013.08.29>
|
|
* adjust output file named.
|
|
* support different month different directory.
|
|
* adjust some detail.
|
|
*
|
|
* VERSION 2.4 <DATE: 2013.10.07>
|
|
* 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 <DATE: 2014.03.25>
|
|
* 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 <DATE: 2014.08.19>
|
|
* 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 <DATE: 2014.08.22>
|
|
* fix bug from defined _MSC_VER
|
|
*
|
|
* VERSION 2.7 <DATE: 2014.09.21>
|
|
* compatible mac machine, now log4z can working in linux/windows/mac.
|
|
*
|
|
* VERSION 2.8 <DATE: 2014.09.27>
|
|
* 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 <DATE: 2014.12.19>
|
|
* 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 <interface/slog-i.h>
|
|
#include <windows.h>
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
//! -----------------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);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|