diff --git a/CMakeLists.txt b/CMakeLists.txt index 88c451a..e8719ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,7 +54,7 @@ add_definitions(-DFL_BUILD_PATH="${CMAKE_SOURCE_DIR}") #used to determine FL__FI set(FL_LIBS) if(UNIX) - set(CMAKE_CXX_FLAGS "-Werror -Wall -Wextra") + set(CMAKE_CXX_FLAGS "-Werror -Wall -Wextra -fPIC") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") if(NOT APPLE) @@ -77,6 +77,8 @@ if(NOT FL_BACKTRACE) endif() include_directories(.) +include_directories ("${PROJECT_SOURCE_DIR}/LoggerCpp/include/") +add_definitions (-std=c++0x) # -std=c++11 file(STRINGS FL_HEADERS fl-headers) file(STRINGS FL_SOURCES fl-sources) @@ -87,16 +89,45 @@ string(REGEX REPLACE "\n" " " ${fl-sources} ${fl-sources}) message("${exepath}") +# add sources of the logger library as a "LoggerCpp" library +add_library (LoggerCpp STATIC + LoggerCpp/include/LoggerCpp/Channel.h + LoggerCpp/include/LoggerCpp/Config.h + LoggerCpp/include/LoggerCpp/DateTime.h + LoggerCpp/include/LoggerCpp/Exception.h + LoggerCpp/include/LoggerCpp/Formatter.h + LoggerCpp/include/LoggerCpp/Log.h + LoggerCpp/include/LoggerCpp/Logger.h + LoggerCpp/include/LoggerCpp/LoggerCpp.h + LoggerCpp/include/LoggerCpp/Manager.h + LoggerCpp/include/LoggerCpp/Output.h + LoggerCpp/include/LoggerCpp/OutputConsole.h + LoggerCpp/include/LoggerCpp/OutputDebug.h + LoggerCpp/include/LoggerCpp/OutputFile.h + LoggerCpp/include/LoggerCpp/shared_ptr.hpp + LoggerCpp/include/LoggerCpp/Utils.h + LoggerCpp/src/Config.cpp + LoggerCpp/src/DateTime.cpp + LoggerCpp/src/Log.cpp + LoggerCpp/src/Logger.cpp + LoggerCpp/src/Manager.cpp + LoggerCpp/src/OutputConsole.cpp + LoggerCpp/src/OutputDebug.cpp + LoggerCpp/src/OutputFile.cpp +) +#set_target_properties(LoggerCpp PROPERTIES COMPILE_FLAGS -fvisibility=hidden) + + set(CMAKE_DEBUG_POSTFIX -dbg) add_library(fl-shared SHARED ${fl-headers} ${fl-sources}) set_target_properties(fl-shared PROPERTIES OUTPUT_NAME fuzzylite) set_target_properties(fl-shared PROPERTIES VERSION ${FL_VERSION} SOVERSION ${FL_VERSION}) -target_link_libraries(fl-shared ${FL_LIBS}) +target_link_libraries(fl-shared ${FL_LIBS} LoggerCpp) -add_library(fl-static STATIC ${fl-headers} ${fl-sources}) -set_target_properties(fl-static PROPERTIES OUTPUT_NAME fuzzylite-static) -target_link_libraries(fl-static ${FL_LIBS}) +#add_library(fl-static STATIC ${fl-headers} ${fl-sources}) +#set_target_properties(fl-static PROPERTIES OUTPUT_NAME fuzzylite-static) +#target_link_libraries(fl-static ${FL_LIBS} LoggerCpp) add_executable(fl-bin fl/Console.h src/Console.cpp src/main.cpp) set_target_properties(fl-bin PROPERTIES OUTPUT_NAME fuzzylite) @@ -106,7 +137,7 @@ target_link_libraries(fl-bin fl-shared ${FL_LIBS}) include(GNUInstallDirs) -install(TARGETS fl-bin fl-shared fl-static +install(TARGETS fl-bin fl-shared RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/LoggerCpp/.gitignore b/LoggerCpp/.gitignore new file mode 100644 index 0000000..961e345 --- /dev/null +++ b/LoggerCpp/.gitignore @@ -0,0 +1,27 @@ +Debug +Release +build +lib +doc + +CMakeCache.txt +CMakeFiles +*.cmake +*.dir + +*.sln +*.vcproj* +*.vcxproj* +*.ncb +*.suo +*.user +*sdf +*ipch +*.make +Makefile +.settings + +*~ + +log*.txt +core diff --git a/LoggerCpp/CMakeLists.txt b/LoggerCpp/CMakeLists.txt new file mode 100644 index 0000000..b280dfd --- /dev/null +++ b/LoggerCpp/CMakeLists.txt @@ -0,0 +1,106 @@ +# Copyright (c) 2013 Sebastien Rombauts (sebastien.rombauts@gmail.com) +# +# Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt +# or copy at http://opensource.org/licenses/MIT) + +cmake_minimum_required(VERSION 2.6) +project(LoggerCpp) + +# Define useful variables to handle OS/Compiler differences +if (MSVC) + set(CPPLINT_ARG_OUTPUT "--output=vs7") + set(CPPCHECK_ARG_TEMPLATE "--template=vs") + set(DEV_NULL "NUL") + set(SYSTEM_LIBRARIES "") + add_definitions (/D_CRT_SECURE_NO_WARNINGS) +else() + set(CPPLINT_ARG_OUTPUT "--output=eclipse") + set(CPPCHECK_ARG_TEMPLATE "--template=gcc") + set(DEV_NULL "/dev/null") + set(SYSTEM_LIBRARIES "rt") + add_definitions (-std=c++0x) # -std=c++11 +endif() +set(CPPLINT_ARG_VERBOSE "--verbose=3") +set(CPPLINT_ARG_LINELENGTH "--linelength=120") + +# All includes are relative to the "include" directory +include_directories ("${PROJECT_SOURCE_DIR}/include") + +# add sources of the logger library as a "LoggerCpp" library +add_library (LoggerCpp + include/LoggerCpp/Channel.h + include/LoggerCpp/Config.h + include/LoggerCpp/DateTime.h + include/LoggerCpp/Exception.h + include/LoggerCpp/Formatter.h + include/LoggerCpp/Log.h + include/LoggerCpp/Logger.h + include/LoggerCpp/LoggerCpp.h + include/LoggerCpp/Manager.h + include/LoggerCpp/Output.h + include/LoggerCpp/OutputConsole.h + include/LoggerCpp/OutputDebug.h + include/LoggerCpp/OutputFile.h + include/LoggerCpp/shared_ptr.hpp + include/LoggerCpp/Utils.h + src/Config.cpp + src/DateTime.cpp + src/Log.cpp + src/Logger.cpp + src/Manager.cpp + src/OutputConsole.cpp + src/OutputDebug.cpp + src/OutputFile.cpp +) + + +# Optional additional targets: + +option(LOGGERCPP_BUILD_EXAMPLE "Build the example of LoggerCpp." ON) +if (LOGGERCPP_BUILD_EXAMPLE) + # add the example executable, linked with the LoggerCpp library + add_executable(LoggerCpp_Example examples/Main.cpp) + target_link_libraries (LoggerCpp_Example LoggerCpp ${SYSTEM_LIBRARIES}) +endif () + +option(LOGGERCPP_RUN_CPPLINT "Run cpplint.py tool for Google C++ StyleGuide." ON) +if (LOGGERCPP_RUN_CPPLINT) + # List all sources/headers files for cpplint: + # adding a file still require explicittly modifing the CMakeLists.txt + # so that CMake know that it should rebuild the project (it is best practice) + file(GLOB all_source_files + "${PROJECT_SOURCE_DIR}/include/LoggerCpp/*.h" + "${PROJECT_SOURCE_DIR}/src/*.cpp" + ) + + # add a cpplint target to the "all" target + add_custom_target(LoggerCpp_cpplint + ALL + COMMAND python cpplint.py ${CPPLINT_ARG_OUTPUT} ${CPPLINT_ARG_VERBOSE} ${all_source_files} + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + ) +endif() + +option(LOGGERCPP_RUN_CPPCHECK "Run cppcheck C++ static analysis tool." ON) +if (LOGGERCPP_RUN_CPPCHECK) + # add a cppcheck target to the "all" target + add_custom_target(LoggerCpp_cppcheck + ALL + COMMAND cppcheck -j 4 cppcheck --enable=style --quiet ${CPPCHECK_ARG_TEMPLATE} ${PROJECT_SOURCE_DIR}/src + ) +endif() + +if (NOT DEFINED ENV{TRAVIS}) + option(LOGGERCPP_RUN_DOXYGEN "Run Doxygen C++ documentation tool." ON) + if (LOGGERCPP_RUN_DOXYGEN) + # add a Doxygen target to the "all" target + add_custom_target(LoggerCpp_doxygen + ALL + COMMAND doxygen Doxyfile > ${DEV_NULL} + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + ) + endif() +else() + # but no Doxygen under Travis CI: too costly and no real benefit + message("no Doxygen target when TRAVIS is defined") +endif() diff --git a/LoggerCpp/Doxyfile b/LoggerCpp/Doxyfile new file mode 100644 index 0000000..4f2e678 --- /dev/null +++ b/LoggerCpp/Doxyfile @@ -0,0 +1,1874 @@ +# Doxyfile 1.8.3.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or sequence of words) that should +# identify the project. Note that if you do not use Doxywizard you need +# to put quotes around the project name if it contains spaces. + +PROJECT_NAME = Logger + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = 0.2.0 + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer +# a quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = "A simple, elegant and efficient C++ logger library." + +# With the PROJECT_LOGO tag one can specify an logo or icon that is +# included in the documentation. The maximum height of the logo should not +# exceed 55 pixels and the maximum width should not exceed 200 pixels. +# Doxygen will copy the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = doc + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, +# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English +# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, +# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, +# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. Note that you specify absolute paths here, but also +# relative paths, which will be relative from the directory where doxygen is +# started. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful if your file system +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 7 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding +# "class=itcl::class" will allow you to use the command class in the +# itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, +# and language is one of the parsers supported by doxygen: IDL, Java, +# Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, +# C++. For instance to make doxygen treat .inc files as Fortran files (default +# is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note +# that for custom extensions you also need to set FILE_PATTERNS otherwise the +# files are not read by doxygen. + +EXTENSION_MAPPING = + +# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all +# comments according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you +# can mix doxygen, HTML, and XML commands with Markdown formatting. +# Disable only in case of backward compatibilities issues. + +MARKDOWN_SUPPORT = YES + +# When enabled doxygen tries to link words that correspond to documented classes, +# or namespaces to their corresponding documentation. Such a link can be +# prevented in individual cases by by putting a % sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also makes the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES (the +# default) will make doxygen replace the get and set methods by a property in +# the documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and +# unions are shown inside the group in which they are included (e.g. using +# @ingroup) instead of on a separate page (for HTML and Man pages) or +# section (for LaTeX and RTF). + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and +# unions with only public data fields will be shown inline in the documentation +# of the scope in which they are defined (i.e. file, namespace, or group +# documentation), provided this scope is documented. If set to NO (the default), +# structs, classes, and unions are shown on a separate page (for HTML and Man +# pages) or section (for LaTeX and RTF). + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penalty. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will roughly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols. + +SYMBOL_CACHE_SIZE = 0 + +# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be +# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given +# their name and scope. Since this can be an expensive process and often the +# same symbol appear multiple times in the code, doxygen keeps a cache of +# pre-resolved symbols. If the cache is too small doxygen will become slower. +# If the cache is too large, memory is wasted. The cache size is given by this +# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = YES + +# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal +# scope will be included in the documentation. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespaces are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen +# will list include files with double quotes in the documentation +# rather than with sharp brackets. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen +# will sort the (brief and detailed) documentation of class members so that +# constructors and destructors are listed first. If set to NO (the default) +# the constructors will appear in the respective orders defined by +# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. +# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO +# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to +# do proper type resolution of all parameters of a function it will reject a +# match between the prototype and the implementation of a member function even +# if there is only one candidate or it is obvious which candidate to choose +# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen +# will still accept a match between prototype and implementation in such cases. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if section-label ... \endif +# and \cond section-label ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or macro consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and macros in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = NO + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. +# You can optionally specify a file name after the option, if omitted +# DoxygenLayout.xml will be used as the name of the layout file. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files +# containing the references data. This must be a list of .bib files. The +# .bib extension is automatically appended if omitted. Using this command +# requires the bibtex tool to be installed. See also +# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style +# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this +# feature you need bibtex and perl available in the search path. Do not use +# file names with spaces, bibtex cannot handle them. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# The WARN_NO_PARAMDOC option can be enabled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = YES + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +# GCC format: +WARN_FORMAT = "$file:$line: $text" +# MSVC format: +#WARN_FORMAT = "$file($line): $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = src include + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh +# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py +# *.f90 *.f *.for *.vhd *.vhdl + +FILE_PATTERNS = *.cpp \ + *.h \ + *.hpp + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = include/LoggerCpp/shared_ptr.hpp + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty or if +# non of the patterns match the file name, INPUT_FILTER is applied. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) +# and it is also possible to disable source filtering for a specific pattern +# using *.ext= (so without naming a filter). This option only has effect when +# FILTER_SOURCE_FILES is enabled. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MD_FILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page (index.html). +# This can be useful if you have a project on for instance GitHub and want reuse +# the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C, C++ and Fortran comments will always remain visible. + +STRIP_CODE_COMMENTS = NO + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentation. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. Note that when using a custom header you are responsible +# for the proper inclusion of any scripts and style sheets that doxygen +# needs, which is dependent on the configuration options used. +# It is advised to generate a default header using "doxygen -w html +# header.html footer.html stylesheet.css YourConfigFile" and then modify +# that header. Note that the header is subject to change so you typically +# have to redo this when upgrading to a newer version of doxygen or when +# changing the value of configuration settings such as GENERATE_TREEVIEW! + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If left blank doxygen will +# generate a default style sheet. Note that it is recommended to use +# HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this +# tag will in the future become obsolete. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional +# user-defined cascading style sheet that is included after the standard +# style sheets created by doxygen. Using this option one can overrule +# certain style aspects. This is preferred over using HTML_STYLESHEET +# since it does not replace the standard style sheet and is therefor more +# robust against future updates. Doxygen will copy the style sheet file to +# the output directory. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that +# the files will be copied as-is; there are no commands or markers available. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. +# Doxygen will adjust the colors in the style sheet and background images +# according to this color. Hue is specified as an angle on a colorwheel, +# see http://en.wikipedia.org/wiki/Hue for more information. +# For instance the value 0 represents red, 60 is yellow, 120 is green, +# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. +# The allowed range is 0 to 359. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of +# the colors in the HTML output. For a value of 0 the output will use +# grayscales only. A value of 255 will produce the most vivid colors. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to +# the luminance component of the colors in the HTML output. Values below +# 100 gradually make the output lighter, whereas values above 100 make +# the output darker. The value divided by 100 is the actual gamma applied, +# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, +# and 100 does not change the gamma. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting +# this to NO can help when comparing the output of multiple runs. + +HTML_TIMESTAMP = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of +# entries shown in the various tree structured indices initially; the user +# can expand and collapse entries dynamically later on. Doxygen will expand +# the tree to such a level that at most the specified number of entries are +# visible (unless a fully collapsed tree already exceeds this amount). +# So setting the number of entries 1 will produce a full collapsed tree by +# default. 0 is a special value representing an infinite number of entries +# and will result in a full expanded tree by default. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely +# identify the documentation publisher. This should be a reverse domain-name +# style string, e.g. com.mycompany.MyDocSet.documentation. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated +# that can be used as input for Qt's qhelpgenerator to generate a +# Qt Compressed Help (.qch) of the generated HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to +# add. For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see +# +# Qt Help Project / Custom Filters. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's +# filter section matches. +# +# Qt Help Project / Filter Attributes. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files +# will be generated, which together with the HTML files, form an Eclipse help +# plugin. To install this plugin and make it available under the help contents +# menu in Eclipse, the contents of the directory containing the HTML and XML +# files needs to be copied into the plugins directory of eclipse. The name of +# the directory within the plugins directory should be the same as +# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before +# the help appears. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have +# this name. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) +# at top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. Since the tabs have the same information as the +# navigation tree you can set this option to NO if you already set +# GENERATE_TREEVIEW to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to YES, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). +# Windows users are probably better off using the HTML help feature. +# Since the tree basically has the same information as the tab index you +# could consider to set DISABLE_INDEX to NO when enabling this option. + +GENERATE_TREEVIEW = YES + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values +# (range [0,1..20]) that doxygen will group on one line in the generated HTML +# documentation. Note that a value of 0 will completely suppress the enum +# values from appearing in the overview section. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open +# links to external symbols imported via tag files in a separate window. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are +# not supported properly for IE 6.0, but are supported on all modern browsers. +# Note that when changing this option you need to delete any form_*.png files +# in the HTML output before the changes have effect. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax +# (see http://www.mathjax.org) which uses client side Javascript for the +# rendering instead of using prerendered bitmaps. Use this if you do not +# have LaTeX installed or if you want to formulas look prettier in the HTML +# output. When enabled you may also need to install MathJax separately and +# configure the path to it using the MATHJAX_RELPATH option. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# thA MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and +# SVG. The default value is HTML-CSS, which is slower, but has the best +# compatibility. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the +# HTML output directory using the MATHJAX_RELPATH option. The destination +# directory should contain the MathJax.js script. For instance, if the mathjax +# directory is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to +# the MathJax Content Delivery Network so you can quickly see the result without +# installing MathJax. However, it is strongly recommended to install a local +# copy of MathJax from http://www.mathjax.org before deployment. + +MATHJAX_RELPATH = http://www.mathjax.org/mathjax + +# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension +# names that should be enabled during MathJax rendering. + +MATHJAX_EXTENSIONS = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box +# for the HTML output. The underlying search engine uses javascript +# and DHTML and should work on any modern browser. Note that when using +# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets +# (GENERATE_DOCSET) there is already a search function so this one should +# typically be disabled. For large projects the javascript based search engine +# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. + +SEARCHENGINE = YES + +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be +# implemented using a web server instead of a web client using Javascript. +# There are two flavours of web server based search depending on the +# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for +# searching and an index file used by the script. When EXTERNAL_SEARCH is +# enabled the indexing and searching needs to be provided by external tools. +# See the manual for details. + +SERVER_BASED_SEARCH = NO + +# When EXTERNAL_SEARCH is enabled doxygen will no longer generate the PHP +# script for searching. Instead the search results are written to an XML file +# which needs to be processed by an external indexer. Doxygen will invoke an +# external search engine pointed to by the SEARCHENGINE_URL option to obtain +# the search results. Doxygen ships with an example indexer (doxyindexer) and +# search engine (doxysearch.cgi) which are based on the open source search engine +# library Xapian. See the manual for configuration details. + +EXTERNAL_SEARCH = NO + +# The SEARCHENGINE_URL should point to a search engine hosted by a web server +# which will returned the search results when EXTERNAL_SEARCH is enabled. +# Doxygen ships with an example search engine (doxysearch) which is based on +# the open source search engine library Xapian. See the manual for configuration +# details. + +SEARCHENGINE_URL = + +# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed +# search data is written to a file for indexing by an external tool. With the +# SEARCHDATA_FILE tag the name of this file can be specified. + +SEARCHDATA_FILE = searchdata.xml + +# When SERVER_BASED_SEARCH AND EXTERNAL_SEARCH are both enabled the +# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is +# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple +# projects and redirect the results back to the right project. + +EXTERNAL_SEARCH_ID = + +# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen +# projects other than the one defined by this configuration file, but that are +# all added to the same external search index. Each project needs to have a +# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id +# of to a relative location where the documentation can be found. +# The format is: EXTRA_SEARCH_MAPPINGS = id1=loc1 id2=loc2 ... + +EXTRA_SEARCH_MAPPINGS = + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. +# Note that when enabling USE_PDFLATEX this option is only used for +# generating bitmaps for formulas in the HTML output, but not in the +# Makefile that is written to the output directory. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4 + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for +# the generated latex document. The footer should contain everything after +# the last chapter. If it is left blank doxygen will generate a +# standard footer. Notice: only use this tag if you know what you are doing! + +LATEX_FOOTER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +# If LATEX_SOURCE_CODE is set to YES then doxygen will include +# source code with syntax highlighting in the LaTeX output. +# Note that which sources are shown also depends on other settings +# such as SOURCE_BROWSER. + +LATEX_SOURCE_CODE = NO + +# The LATEX_BIB_STYLE tag can be used to specify the style to use for the +# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See +# http://en.wikipedia.org/wiki/BibTeX for more info. + +LATEX_BIB_STYLE = plain + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load style sheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# pointed to by INCLUDE_PATH will be searched when a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition that +# overrules the definition found in the source code. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all references to function-like macros +# that are alone on a line, have an all uppercase name, and do not end with a +# semicolon, because these will confuse the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. For each +# tag file the location of the external documentation should be added. The +# format of a tag file without this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths +# or URLs. Note that each tag file must have a unique name (where the name does +# NOT include the path). If a tag file is not located in the directory in which +# doxygen is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option also works with HAVE_DOT disabled, but it is recommended to +# install and use dot, since it yields more powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = YES + +# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is +# allowed to run in parallel. When set to 0 (the default) doxygen will +# base this on the number of processors available in the system. You can set it +# explicitly to a value larger than 0 to get control over the balance +# between CPU load and processing speed. + +DOT_NUM_THREADS = 0 + +# By default doxygen will use the Helvetica font for all dot files that +# doxygen generates. When you want a differently looking font you can specify +# the font name using DOT_FONTNAME. You need to make sure dot is able to find +# the font, which can be done by putting it in a standard location or by setting +# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the +# directory containing the font. + +DOT_FONTNAME = Helvetica + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the Helvetica font. +# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to +# set the path where dot can find it. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If the UML_LOOK tag is enabled, the fields and methods are shown inside +# the class node. If there are many fields or methods and many nodes the +# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS +# threshold limits the number of items for each type to make the size more +# managable. Set this to 0 for no limit. Note that the threshold may be +# exceeded by 50% before the limit is enforced. + +UML_LIMIT_NUM_FIELDS = 10 + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = YES + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = YES + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will generate a graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are svg, png, jpg, or gif. +# If left blank png will be used. If you choose svg you need to set +# HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible in IE 9+ (other browsers do not have this requirement). + +DOT_IMAGE_FORMAT = png + +# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to +# enable generation of interactive SVG images that allow zooming and panning. +# Note that this requires a modern browser other than Internet Explorer. +# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you +# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible. Older versions of IE do not have SVG support. + +INTERACTIVE_SVG = NO + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MSCFILE_DIRS tag can be used to specify one or more directories that +# contain msc files that are included in the documentation (see the +# \mscfile command). + +MSCFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES diff --git a/LoggerCpp/LICENSE.txt b/LoggerCpp/LICENSE.txt new file mode 100644 index 0000000..f82df56 --- /dev/null +++ b/LoggerCpp/LICENSE.txt @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2013 Sebastien Rombauts (sebastien.rombauts@gmail.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. \ No newline at end of file diff --git a/LoggerCpp/README.md b/LoggerCpp/README.md new file mode 100644 index 0000000..66171ab --- /dev/null +++ b/LoggerCpp/README.md @@ -0,0 +1,138 @@ +LoggerC++ +--------- + +![LoggerC++ build status](https://api.travis-ci.org/SRombauts/LoggerCpp.png "LoggerC++ build status") + +LoggerC++ (LoggerCpp) is a simple, elegant and efficient C++ logger library. + +### The goals of LoggerC++ are: + +- to keep dependencies to a minimum (STL and shared_ptr) +- to be portable +- to minimize cpu utilisation when no log are outputed +- to be thread-safe (output logs in same channel accross multiple threads) +- to be well documented with Doxygen tags +- to use a permissive MIT license, similar to BSD or Boost, for proprietary/commercial usage + +### Limitations: + +Thread-safety is only for Log outputs. +You shall not dynamically create and destroy Logger objects in multiple threads. +Instead, build them all at startup in you main thread, before other thread startup. +Then you are allowed to use them all in parallel. + +### Suported platforms: + +Developements and tests are done under the following OSs : +- Debian 7 (testing) +- Ubuntu 12.10 +- Windows XP/7/8 +And following IDEs/Compilers +- GCC 4.7.x with a provided Makefile +- Eclipse CDT under Linux, using the provided Makefile +- Visual Studio Express 2008/2010/2012 for testing compatibility purpose + +### Dependencies: + +- a STL implementation with RTTI (even an old one, like the one provided with VC6 should work). +- optionnaly: the C++ 11 std::shared_ptr or boost::shared_ptr (a minimal shared_ptr implementation is provided). + +### Installation + +To use this C++ Logger, you need to include the sources files into your project codebase. + +### License + +Copyright (c) 2013 Sébastien Rombauts (sebastien.rombauts@gmail.com) + +Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt +or copy at http://opensource.org/licenses/MIT) + +## Getting started +### Principles + +- Add a small named Logger object to your code to output logs prefixed by the given name. +A Logger is as small as a shared_ptr, typicaly 8 bytes. +Use it as a member variable to your class, or as a free variable. +- Build a Log with standard stream manipulations (like with std::cout) +but in a thread-safe manner: the Log is outputed atomically at the end of the line. +- Use one of the 6 Log Level, ranging from Debug to Critic in a standard fashion. +- Set the Channel Level of the Logger to dynamicaly filter Log to be outputed +- Multiple Logger objects with the same name will share the same underlying named Channel. +Any of theses Logger can manipulate the Channel output Level. +- Configure the availlable Output objects, for console, file or MSVC Debugger output. + +### First sample demonstrates how to create a Logger and print some logs: + +```C++ +int main () +{ + // Configure the default severity Level of new Channel objects + Log::Manager::setDefaultLevel(Log::Log::eNotice); + + // Setup the list of Config for the Output objects, + Log::Config::Vector configList; + Log::Config::addOutput(configList, "OutputConsole"); + Log::Config::addOutput(configList, "OutputFile"); + Log::Config::setOption(configList, "filename", "log.txt"); + Log::Config::setOption(configList, "max_size", "10000"); + // and configure the Log Manager (create the Output objects) + Log::Manager::configure(configList); + + // Create a Logger object, using a "Main.Example" Channel + Log::Logger logger("Main.Example"); + + // Test outputs of various kind of variables, and some common stream manipulations. + std::string str("string"); + unsigned int ui = 123; + double dbl = -0.023f; + logger.debug() << "Variables ; '" << str << "', '" << ui << "', '" << dbl << "'"; + logger.debug() << "Hexa = " << std::hex << 0x75af0 << " test"; + logger.debug() << "Deci = " << std::right << std::setfill('0') << std::setw(8) << 76035 << " test"; + + // Test outputs of various severity Level + logger.debug() << "Debug."; + logger.info() << "Info."; + logger.notice() << "Notice."; + logger.warning()<< "Warning."; + logger.error() << "Error."; + logger.critic() << "Critic."; + + // Modify the output Level of the underlying Channel, and test various severity Level again + logger.setLevel(Log::Log::eWarning); + logger.debug() << "NO Debug."; // NO more debug logs + logger.info() << "NO Info."; // NO more info logs + logger.notice() << "NO Notice."; // NO more notice logs + logger.warning()<< "Warning."; + logger.error() << "Error."; + logger.critic() << "Critic."; + + // Reset Level of the "Main.example" channel by its name + Log::Manager::get("Main.Example")->setLevel(Log::Log::eDebug); +``` + +## How to contribute +### GitHub website +The most efficient way to help and contribute to this wrapper project is to +use the tools provided by GitHub: +- please fill bug reports and feature requests here: https://github.com/SRombauts/LoggerCpp/issues +- fork the repository, make some small changes and submit them with pull-request + +### Contact +You can also email me directly, I will answer any questions and requests. + +### Coding Style Guidelines +The source code use the CamelCase naming style variant where : +- type names (class, struct, typedef, enums...) begins with a capital letter +- files (.cpp/.h) are named like the class they contains +- function and variable names begins with a lower case letter +- member variables begins with a 'm', function arguments begins with a 'a', boolean with a 'b', pointers with a 'p' +- each file, class, method and member variable is documented using Doxygen tags +See also http://www.appinf.com/download/CppCodingStyleGuide.pdf for good guidelines + +### Continuous Integration + +This project is continuously tested under Ubuntu Linux with the gcc and clang compilers +using the Travis CI community service with the above CMake building and testing procedure. + +Detailed results can be seen online: https://travis-ci.org/SRombauts/LoggerCpp diff --git a/LoggerCpp/TODO.txt b/LoggerCpp/TODO.txt new file mode 100644 index 0000000..8a73609 --- /dev/null +++ b/LoggerCpp/TODO.txt @@ -0,0 +1,21 @@ +Update shared_ptr to tag v1.0 + +test + +Github Pages + +Release + +Manager: configure channels + +Add a basic thread-safety security (throw if multiple threads create Loggers) +- Add a static Thread::getCurrentId() + +Searching for a more compact or standard output format +- XML +- HTML +- json +- db3 +- no SQL +- google protocol buffer +- message pack \ No newline at end of file diff --git a/LoggerCpp/examples/Main.cpp b/LoggerCpp/examples/Main.cpp new file mode 100644 index 0000000..ab1ac21 --- /dev/null +++ b/LoggerCpp/examples/Main.cpp @@ -0,0 +1,147 @@ +/** + * @file Main.cpp + * @brief Example program for the simple LoggerC++ system + * + * Copyright (c) 2013 Sebastien Rombauts (sebastien.rombauts@gmail.com) + * + * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt + * or copy at http://opensource.org/licenses/MIT) + */ + +#include "LoggerCpp/LoggerCpp.h" + +#include + + +/** + * @brief Simple test class + */ +class Tester { +public: + Tester() : + mLogger("main.Tester") + { + } + + void constTest (void) const { + mLogger.debug() << "log within a const method"; + } + +private: + Log::Logger mLogger; ///< A named logger to produce log +}; + + + +/** + * @brief Simple example program + */ +int main () +{ + // Configure the default severity Level of new Channel objects +#ifndef NDEBUG + Log::Manager::setDefaultLevel(Log::Log::eDebug); +#else + Log::Manager::setDefaultLevel(Log::Log::eNotice); +#endif + + int val; + if (false) + { + val = 2; + } + if (true) + { + // TODO SRombauts : testing + int* p = new int(2); + } + + // Configure the Output objects + Log::Config::Vector configList; + Log::Config::addOutput(configList, "OutputConsole"); + Log::Config::addOutput(configList, "OutputFile"); + Log::Config::setOption(configList, "filename", "log.txt"); + Log::Config::setOption(configList, "filename_old", "log.old.txt"); + Log::Config::setOption(configList, "max_startup_size", "0"); + Log::Config::setOption(configList, "max_size", "10000"); +#ifdef WIN32 + Log::Config::addOutput(configList, "OutputDebug"); +#endif + + // Create a Logger object, using a "Main.Example" Channel + Log::Logger logger("Main.Example"); + logger.warning() << "NO logs before configure()"; + + try + { + // Configure the Log Manager (create the Output objects) + //Log::Manager::configure(configList); + std::cout << "Configure" << std::endl; + } + catch (std::exception& e) + { + std::cerr << e.what(); + } + + // Test outputs of various kind of variables, and some common stream manipulations. + std::string str("string"); + unsigned int ui = 123; + double dbl = -0.023f; + logger.debug() << "Variables ; '" << str << "', '" << ui << "', '" << dbl << "'"; + logger.debug() << "Hexa = " << std::hex << 0x75af0 << " test"; + logger.debug() << "Deci = " << std::right << std::setfill('0') << std::setw(8) << 76035 << " test"; + logger.debug() << "sizeof(logger)=" << sizeof(logger); + + // Test outputs of various severity Level + logger.debug() << "Debug."; + logger.info() << "Info."; + logger.notice() << "Notice."; + logger.warning()<< "Warning."; + logger.error() << "Error."; + logger.critic() << "Critic."; + + // Modify the output Level of the underlying Channel, and test various severity Level again + logger.setLevel(Log::Log::eWarning); + logger.debug() << "NO Debug."; // NO more debug logs + logger.info() << "NO Info."; // NO more info logs + logger.notice() << "NO Notice."; // NO more notice logs + logger.warning()<< "Warning."; + logger.error() << "Error."; + logger.critic() << "Critic."; + + // Reset Level of the "Main.example" channel by its name + Log::Manager::get("Main.Example")->setLevel(Log::Log::eDebug); + + // Create other loggers, sharing the "Main.Example" Channel, and creating a new one + Log::Logger logger2("Main.Example"); + Log::Logger logger3("Main.Other"); + logger.debug() << "First logger to the Channel"; + logger2.debug() << "Second logger to the Channel"; + logger3.debug() << "Third logger, other Channel"; + // Modify the Level of the "Main.example" channel by its name + Log::Manager::get("Main.Example")->setLevel(Log::Log::eInfo); + logger.debug() << "first logger inhibited"; // NO more debug logs for this logger + logger2.debug() << "second logger also disabled"; // NO more debug logs (sharing the same underlying channel) + logger3.debug() << "third logger still active"; + // Reset the Level of the "Main.example" channel by its name + Log::Manager::get("Main.Example")->setLevel(Log::Log::eDebug); + logger.debug() << "first logger re-activated"; + logger2.debug() << "second logger also re-activated"; + logger3.debug() << "third logger always active"; + + // Create an object using a Logger as member variable + Tester tester; + tester.constTest(); + + // Show how to get the current Channel configuration (to save it to a file, for instance) + Log::Manager::get("Main.OtherChannel")->setLevel(Log::Log::eNotice); + Log::Config::Ptr ChannelConfigPtr = Log::Manager::getChannelConfig(); + // Show how to set the current Channel configuration (restored from a file, for instance) + Log::Manager::setChannelConfig(ChannelConfigPtr); + + // Terminate the Log Manager (destroy the Output objects) + Log::Manager::terminate(); + logger.warning() << "NO more logs after terminate()"; + + return 0; +} diff --git a/LoggerCpp/include/LoggerCpp/Channel.h b/LoggerCpp/include/LoggerCpp/Channel.h new file mode 100644 index 0000000..e2ec54c --- /dev/null +++ b/LoggerCpp/include/LoggerCpp/Channel.h @@ -0,0 +1,87 @@ +/** + * @file Channel.h + * @ingroup LoggerCpp + * @brief The named channel shared by Logger objects using the same name + * + * Copyright (c) 2013 Sebastien Rombauts (sebastien.rombauts@gmail.com) + * + * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt + * or copy at http://opensource.org/licenses/MIT) + */ +#pragma once + +#include "LoggerCpp/Log.h" + +#include +#include + +// The following includes "boost/shared_ptr.hpp" if LOGGER_USE_BOOST_SHARED_PTR is defined, +// or (or ) when C++11 (or experimental C++0x) is available, +// or a custom minimal shared_ptr implementation, +// and imports the "shared_ptr" symbol inside the Log namespace (ie. Log::shared_ptr) +#include "LoggerCpp/shared_ptr.hpp" + + +namespace Log { + + +/** + * @brief The named channel shared by Logger objects using the same name + * @ingroup LoggerCpp + * + * A Channel is the underlying object used by one or many Logger objects to + * associate a named prefix and an output Log::Level. + * Sharing a same Channel between multiple Logger enable changing the + * Level of many Logger objects at once. + */ +class Channel { +public: + /// @brief Shared Pointer to a Channel object + typedef shared_ptr Ptr; + /// @brief Map of shared pointer of Channel objects + typedef std::map Map; + +public: + /** + * @brief Initialize a named Channel + * + * @param[in] apChannelName String to identify origin of Log output by this Channel + * @param[in] aChannelLevel The default minimum Log::Level of severity from which to output Log + */ + Channel(const char* apChannelName, Log::Level aChannelLevel) : + mName(apChannelName), + mLevel(aChannelLevel) + {} + + /// @brief Non virtual destructor + ~Channel(void) { + } + + /// @brief Name of the Channel + inline const std::string& getName(void) const { + return mName; + } + + /// @brief Set the current output Log::Level of the Channel + inline void setLevel(Log::Level aLevel) { + mLevel = aLevel; + } + + /// @brief Current Log::Level of the Channel + inline Log::Level getLevel(void) const { + return mLevel; + } + +private: + /// @{ Non-copyable object + Channel(Channel&); + void operator=(Channel&); + /// @} + +private: + std::string mName; ///< Name of the Channel + Log::Level mLevel; ///< Current Log::Level of the Channel +}; + + +} // namespace Log diff --git a/LoggerCpp/include/LoggerCpp/Config.h b/LoggerCpp/include/LoggerCpp/Config.h new file mode 100644 index 0000000..8d0f41a --- /dev/null +++ b/LoggerCpp/include/LoggerCpp/Config.h @@ -0,0 +1,123 @@ +/** + * @file Config.h + * @ingroup LoggerCpp + * @brief Configuration for an Output object + * + * Copyright (c) 2013 Sebastien Rombauts (sebastien.rombauts@gmail.com) + * + * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt + * or copy at http://opensource.org/licenses/MIT) + */ +#pragma once + +#include +#include +#include + +// The following includes "boost/shared_ptr.hpp" if LOGGER_USE_BOOST_SHARED_PTR is defined, +// or (or ) when C++11 (or experimental C++0x) is available, +// or a custom minimal shared_ptr implementation, +// and imports the "shared_ptr" symbol inside the Log namespace (ie. Log::shared_ptr) +#include "LoggerCpp/shared_ptr.hpp" + + +namespace Log { + + +// forward declaration +class Logger; + + +/** + * @brief Configuration for an Output object + * @ingroup LoggerCpp + * + * A Config object is an associative container of strings key and values, + * with easy to use helper manipulation functions. + */ +class Config { +public: + /// @brief Shared Pointer to a Config object + typedef shared_ptr Ptr; + /// @brief List of Config objects + typedef std::vector Vector; + /// @brief Map of string values + typedef std::map Values; + +public: + /** + * @brief Constructor + * + * @param[in] apName Name of the Config object + */ + explicit Config(const char* apName); + + /// @brief Non virtual destructor + ~Config(void); + + /// @brief Get the name of this Config object + inline const std::string& getName(void) const { + return mName; + } + + /// @brief Get the string values of this Config object + inline const Values& getValues(void) const { + return mValues; + } + + /** + * @brief Set a string value + * + * @param[in] apKey String key identifying the string value + * @param[in] apValue String value associated to the given key + */ + inline void setValue(const char* apKey, const char* apValue) { + mValues[apKey] = apValue; + } + + /** + * @brief Get a string value, or return the provided default one + * + * @param[in] apKey String key identifying the string value + * @param[in] apDefaultValue String default value + * + * @return String value associated to the given key + */ + const char* get(const char* apKey, const char* apDefaultValue) const; + + /** + * @brief Get a long value, or return the provided default one + * + * @param[in] apKey String key identifying the string value + * @param[in] aDefaultValue Long default value + * + * @return Long value associated to the given key + */ + long get(const char* apKey, const long aDefaultValue) const; + +public: + /** + * @brief Create the Config for a new Output + * + * @param[in,out] aConfigList Config list to complete with a new Output + * @param[in] apOutputName Name of the new Output + */ + + static void addOutput(Vector& aConfigList, const char* apOutputName); + /** + * @brief Set an option for the last added Output + * + * @param[in,out] aConfigList Config list to complete with a new option value + * @param[in] apKey String key identifying the string value + * @param[in] apValue String value associated to the given key + */ + static void setOption(Vector& aConfigList, const char* apKey, const char* apValue); + +private: + std::string mName; ///< Name of the Config + Values mValues; ///< Map of string values +}; + + +} // namespace Log + diff --git a/LoggerCpp/include/LoggerCpp/DateTime.h b/LoggerCpp/include/LoggerCpp/DateTime.h new file mode 100644 index 0000000..0143e27 --- /dev/null +++ b/LoggerCpp/include/LoggerCpp/DateTime.h @@ -0,0 +1,48 @@ +/** + * @file DateTime.h + * @ingroup LoggerCpp + * @brief Current time precise to the millisecond. + * + * Copyright (c) 2013 Sebastien Rombauts (sebastien.rombauts@gmail.com) + * + * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt + * or copy at http://opensource.org/licenses/MIT) + */ +#pragma once + + +namespace Log { + + +/** + * @brief Current time precise to the millisecond. + * @ingroup LoggerCpp + * + * Using a struct to enable easy direct access to public members. + * + * Under Windows, the time is given to the millisecond. + * Under Linux, the time is given to the microsecond. + */ +struct DateTime { + /** + * @brief Constructor + */ + DateTime(void); + + /** + * @brief Set to current time + */ + void make(void); + + int year; ///< year [0,30827] + int month; ///< month [1,12] + int day; ///< day [1,31] + int hour; ///< hour [0,23] + int minute; ///< minute [0,59] + int second; ///< second [0,59] + int ms; ///< millisecond + int us; ///< microsecond (not under Windows) +}; + + +} // namespace Log diff --git a/LoggerCpp/include/LoggerCpp/Exception.h b/LoggerCpp/include/LoggerCpp/Exception.h new file mode 100644 index 0000000..7225f89 --- /dev/null +++ b/LoggerCpp/include/LoggerCpp/Exception.h @@ -0,0 +1,66 @@ +/** + * @file Exception.h + * @ingroup LoggerCpp + * @brief Encapsulation of an error message on a std::runtime_error. + * + * Copyright (c) 2012-2013 Sebastien Rombauts (sebastien.rombauts@gmail.com) + * + * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt + * or copy at http://opensource.org/licenses/MIT) + */ +#pragma once + +#include "LoggerCpp/Formatter.h" + +#include +#include +#include + + +/// assert() is used in destructors, where exceptions are not allowed +/// (only asserting in debug mode) +/// @todo Enable assertion callback like in SQLiteC++ +#define LOGGER_ASSERT(expression) assert(expression) + + + +#ifdef _WIN32 +// Disable warning C4290: C++ exception specification ignored except to indicate a function is not __declspec(nothrow) +#pragma warning(disable:4290) +#endif + + +namespace Log { + +/** + * @brief Encapsulation of an error message based on std::runtime_error. + * @ingroup LoggerCpp + */ +class Exception : public std::runtime_error { +public: + /** + * @brief Encapsulation of an error message based on std::runtime_error. + * + * @param[in] aErrorMessage The string message describing the error + */ + explicit Exception(const std::string& aErrorMessage) : + std::runtime_error(aErrorMessage) + {} +}; + + +/// @brief Stringify 1/2 : convert an integer to a string (using the following macro) +#define TOSTRING(x) _XSTRING(x) +/// @brief Stringify 2/2 : convert an integer to a string (inner macro) +#define _XSTRING(x) #x + +#ifdef __FUNCTION__ +/// @brief Define __func__ under Windows, to use the same name as with GCC +#define __func__ __FUNCTION__ +#endif + +/// @brief Helper macro to throw an Exception with file/line/function information, using the string stream Formatter +#define LOGGER_THROW(x) throw Exception(Formatter() << __FILE__ << ":" << TOSTRING(__LINE__) << ": " << __func__ << "(): " << x) + + +} // namespace Log diff --git a/LoggerCpp/include/LoggerCpp/Formatter.h b/LoggerCpp/include/LoggerCpp/Formatter.h new file mode 100644 index 0000000..441eb6e --- /dev/null +++ b/LoggerCpp/include/LoggerCpp/Formatter.h @@ -0,0 +1,67 @@ +/** + * @file Formatter.h + * @ingroup LoggerCpp + * @brief A standard string stream formatter with implicit string conversion + * + * Copyright (c) 2013 Sebastien Rombauts (sebastien.rombauts@gmail.com) + * + * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt + * or copy at http://opensource.org/licenses/MIT) + */ +#pragma once + +#include +#include + + +namespace Log { + +/** + * @brief A standard string stream formatter with implicit string conversion + * @ingroup LoggerCpp + * + * It is constructed and initialized by a call to the Formatter() constructor. + * Is is then used by successive standard stream call "<<" to insert data into the stream. + * It is ultimately implicitly converted to std::string when required. + * + * A typical use case is to format a std::exception string message : + * - throw std::runtime_error(Formatter() << "no value for key '" << apKey << "'"); + */ +class Formatter { +public: + /// @brief Constructor + Formatter(void) {} + /// @brief Non virtual destructor + ~Formatter(void) {} + + /** + * @brief stream inserter operator + * + * @param[in] aValue Value to be formatted and inserted into the string stream + * + * @return Current Formatter instance + */ + template + Formatter& operator<< (const T& aValue) { + mStream << aValue; + return (*this); + } + + /// @brief std::string cast operator for implicit conversion + inline operator std::string() const { + return mStream.str(); + } + +private: + /// @{ Non-copyable object + Formatter(const Formatter&); + void operator=(const Formatter&); + /// @} + +private: + std::ostringstream mStream; ///< The underlying string stream +}; + + +} // namespace Log + diff --git a/LoggerCpp/include/LoggerCpp/Log.h b/LoggerCpp/include/LoggerCpp/Log.h new file mode 100644 index 0000000..b8b20f6 --- /dev/null +++ b/LoggerCpp/include/LoggerCpp/Log.h @@ -0,0 +1,134 @@ +/** + * @file Log.h + * @ingroup LoggerCpp + * @brief A RAII (private) log object constructed by the Logger class + * + * Copyright (c) 2013 Sebastien Rombauts (sebastien.rombauts@gmail.com) + * + * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt + * or copy at http://opensource.org/licenses/MIT) + */ +#pragma once + +#include "LoggerCpp/DateTime.h" +#include "LoggerCpp/Utils.h" + +#include +#include // For easy use of parametric manipulators (setfill, setprecision) by client code + + +namespace Log { + + +// forward declaration +class Logger; + + +/** + * @brief A RAII (private) log object constructed by the Logger class + * @ingroup LoggerCpp + * + * a Log represents a full line of log, at a certain Log::Level of severity. + * + * It is constructed and initialized by a call to Logger::debug(), + * Logger::info(), ... or Logger::critic(). + * Is is then used by successive stream call "<<", and is naturally terminated + * by it destructor at the end of the line, calling the Logger::output() method. + * + * It contains all required information for further formating, printing and transmitting + * by the Logger class. + */ +class Log { + friend class Logger; + +public: + /** + * @brief Enumeration of the severity levels + */ + enum Level { + eDebug = 0, + eInfo, + eNotice, + eWarning, + eError, + eCritic + }; + +public: + /** + * @brief stream inserter operator + * + * @param[in] aValue Value to be formatted and inserted into the Log string stream + * + * @return Currents Log instance + */ + template + Log& operator<< (const T& aValue) { + if (nullptr != mpStream) { + *mpStream << aValue; + } + return (*this); + } + + /** + * @brief Destructor : output the Log string stream + */ + ~Log(void); + + /// @brief Severity Level of this Log + inline Level getSeverity(void) const { + return mSeverity; + } + + /// @brief Timestamp of this Log + inline const DateTime& getTime(void) const { + return mTime; + } + + /// @brief The underlying string stream + inline const std::ostringstream& getStream(void) const { + return *mpStream; + } + + /** + * @brief Convert a Level to its string representation + * + * @param[in] aLevel Log severity Level to convert + * + * @return Severity Level description + */ + static const char* toString(Log::Level aLevel); + + /** + * @brief Convert a string representation of a Level to its corresponding value + * + * @param[in] apLevel Log severity string Level + * + * @return Severity Level value + */ + static Log::Level toLevel(const char* apLevel); + +private: + /** + * @brief Construct a RAII (private) log object for the Logger class + * + * @param[in] aLogger Reference to the parent Logger + * @param[in] aSeverity Severity of this Log + */ + Log(const Logger& aLogger, Level aSeverity); + + /// @{ Non-copyable object + Log(const Log&); + void operator=(const Log&); + /// @} + +private: + const Logger& mLogger; ///< Reference to the parent Logger + Level mSeverity; ///< Severity of this Log + DateTime mTime; ///< Timestamp of the output + std::ostringstream* mpStream; ///< The underlying string stream +}; + + +} // namespace Log + diff --git a/LoggerCpp/include/LoggerCpp/Logger.h b/LoggerCpp/include/LoggerCpp/Logger.h new file mode 100644 index 0000000..63c4c1e --- /dev/null +++ b/LoggerCpp/include/LoggerCpp/Logger.h @@ -0,0 +1,91 @@ +/** + * @file Logger.h + * @ingroup LoggerCpp + * @brief A simple thread-safe Logger class + * + * Copyright (c) 2013 Sebastien Rombauts (sebastien.rombauts@gmail.com) + * + * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt + * or copy at http://opensource.org/licenses/MIT) + */ +#pragma once + +#include "LoggerCpp/Log.h" +#include "LoggerCpp/Channel.h" + +#include + + +/** + * @brief LoggerC++ (LoggerCpp) is a simple, elegant and efficient C++ logger library. + * @ingroup LoggerCpp +*/ +namespace Log { + + +/** + * @brief A simple thread-safe logger class + * @ingroup LoggerCpp + * + * Logger is designed to be easy to use, light (size of a shared_ptr) and efficient. + * It can be used as a member variable, and will not consume much CPU + * if the log severity is below the Logger current Log::Level. + * + * @note A Logger object is copyable without any limitations + */ +class Logger { + friend class Log; + +public: + /** + * @brief Initialize a Logger utility object + * + * @param[in] apChannelName String to identify origin of Log output by this Logger + */ + explicit Logger(const char* apChannelName); + /** + * @brief Non virtual destructor + */ + ~Logger(void); + + // A Logger is copyable with its a default copy constructor and copy operator without any problem + + /// @{ Utility const method to produce Log objets, used to collect the stream to output + Log debug(void) const; + Log info(void) const; + Log notice(void) const; + Log warning(void) const; + Log error(void) const; + Log critic(void) const; + /// @} + + /// @brief Name of the underlying Channel + inline const std::string& getName(void) const { + return mChannelPtr->getName(); + } + + /// @brief Set the current output Log::Level of the underlying Channel + inline void setLevel(Log::Level aLevel) { + mChannelPtr->setLevel(aLevel); + } + + /// @brief Current Log::Level of the underlying Channel + inline Log::Level getLevel(void) const { + return mChannelPtr->getLevel(); + } + +private: + /** + * @brief Output the Log. Used only by the Log class destructor. + * + * @param[in] aLog The Log to output + */ + void output(const Log& aLog) const; + +private: + Channel::Ptr mChannelPtr; ///< Shared pointer to the underlying Channel +}; + + +} // namespace Log + diff --git a/LoggerCpp/include/LoggerCpp/LoggerCpp.h b/LoggerCpp/include/LoggerCpp/LoggerCpp.h new file mode 100644 index 0000000..c486e5e --- /dev/null +++ b/LoggerCpp/include/LoggerCpp/LoggerCpp.h @@ -0,0 +1,45 @@ +/** + * @file LoggerCpp.h + * @ingroup LoggerCpp + * @brief LoggerC++ (LoggerCpp) is a simple, elegant and efficient C++ logger library. + * + * Include this main header file in your project to gain access to all functionality provided by the logger. + * + * Copyright (c) 2013 Sebastien Rombauts (sebastien.rombauts@gmail.com) + * + * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt + * or copy at http://opensource.org/licenses/MIT) + */ +/** + * @defgroup LoggerCpp LoggerC++ + * @brief LoggerC++ (LoggerCpp) is a simple, elegant and efficient C++ logger library. + */ +#pragma once + + +// Include useful headers of LoggerC++ +#include "LoggerCpp/Logger.h" +#include "LoggerCpp/Manager.h" + + +/** + * @def LOGGERCPP_VERSION + * @brief Srting version numbers for LoggerC++ + * @ingroup LoggerCpp + * + * The LOGGERCPP_VERSION C preprocessor macro in the LoggerCpp.h header + * evaluates to a string literal that is the LoggerC++ version in the + * format "X.Y.Z" where X is the major version number + * and Y is the minor version number and Z is the release number. + */ +#define LOGGERCPP_VERSION "0.2.0" +/** + * @def LOGGERCPP_VERSION_NUMBER + * @brief Numeric version numbers for LoggerC++ + * @ingroup LoggerCpp + * + * The LOGGERCPP_VERSION_NUMBER C preprocessor macro resolves to an integer + * with the value (X*1000000 + Y*1000 + Z) where X, Y, and Z are the same + * numbers used in [LOGGERCPP_VERSION]. + */ +#define LOGGERCPP_VERSION_NUMBER 0002000 diff --git a/LoggerCpp/include/LoggerCpp/Manager.h b/LoggerCpp/include/LoggerCpp/Manager.h new file mode 100644 index 0000000..276d0e0 --- /dev/null +++ b/LoggerCpp/include/LoggerCpp/Manager.h @@ -0,0 +1,102 @@ +/** + * @file Manager.h + * @ingroup LoggerCpp + * @brief The static class that manage the registered Channel and Output objects + * + * Copyright (c) 2013 Sebastien Rombauts (sebastien.rombauts@gmail.com) + * + * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt + * or copy at http://opensource.org/licenses/MIT) + */ +#pragma once + +#include "LoggerCpp/Log.h" +#include "LoggerCpp/Channel.h" +#include "LoggerCpp/Output.h" +#include "LoggerCpp/Config.h" + + +namespace Log { + + +/** + * @brief The static class that manage the registered channels and outputs + * @ingroup LoggerCpp + * + * The Manager keeps a map of all the named Channel objects + * and share them on demand by new Logger objects created with the same name. + * + * Thus the Manager is able to change the Log::Level of selected Channel object, + * impacting all the Logger objects using it. + * + * The Manager also keeps a list of all configured Output object to output the Log objects. + */ +struct Manager { +public: + /** + * @brief Create and configure the Output objects. + * + * @see setChannelConfig() + * + * @param[in] aConfigList List of Config for Output objects + */ + static void configure(const Config::Vector& aConfigList); + + /** + * @brief Destroy the Output objects. + * + * Clear the Output list to release the ownership. + */ + static void terminate(void); + + /** + * @brief Return the Channel corresponding to the provided name + * + * Create a new Channel or get the existing one. + * + * @param[in] apChannelName String to identify the underlying Channel of a Logger + * + * @return Pointer to the corresponding Channel (never nullptr) + */ + static Channel::Ptr get(const char* apChannelName); + + /** + * @brief Output the Log to all the active Output objects. + * + * Dispatch the Log to OutputConsole/OutputFile/OutputVS/OutputMemory... + * + * @param[in] aChannelPtr The underlying Channel of the Log + * @param[in] aLog The Log to output + */ + static void output(const Channel::Ptr& aChannelPtr, const Log& aLog); + + /** + * @brief Set the default output Log::Level of any new Channel + */ + static inline void setDefaultLevel(Log::Level aLevel) { + mDefaultLevel = aLevel; + } + + /** + * @brief Serialize the current Log::Level of Channel objects and return them as a Config instance + */ + static Config::Ptr getChannelConfig(void); + + /** + * @brief Set the Log::Level of Channel objects from the provided Config instance + */ + static void setChannelConfig(const Config::Ptr& aConfigPtr); + + /** + * @brief Set a Custom Logger + */ + static void setCustomLogger(Output *logger); + +private: + static Channel::Map mChannelMap; ///< Map of shared pointer of Channel objects + static Output::Vector mOutputList; ///< List of Output objects + static Log::Level mDefaultLevel; ///< Default Log::Level of any new Channel +}; + + +} // namespace Log diff --git a/LoggerCpp/include/LoggerCpp/Output.h b/LoggerCpp/include/LoggerCpp/Output.h new file mode 100644 index 0000000..e5290dd --- /dev/null +++ b/LoggerCpp/include/LoggerCpp/Output.h @@ -0,0 +1,61 @@ +/** + * @file Output.h + * @ingroup LoggerCpp + * @brief Interface of an Output + * + * Copyright (c) 2013 Sebastien Rombauts (sebastien.rombauts@gmail.com) + * + * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt + * or copy at http://opensource.org/licenses/MIT) + */ +#pragma once + +#include "LoggerCpp/Channel.h" + +#include +#include + +// The following includes "boost/shared_ptr.hpp" if LOGGER_USE_BOOST_SHARED_PTR is defined, +// or (or ) when C++11 (or experimental C++0x) is available, +// or a custom minimal shared_ptr implementation, +// and imports the "shared_ptr" symbol inside the Log namespace (ie. Log::shared_ptr) +#include "LoggerCpp/shared_ptr.hpp" + + +namespace Log { + + +// Forward declaration +class Log; + +/** + * @brief Interface of an Output + * @ingroup LoggerCpp + */ +class Output { +public: + /// @brief Virtual destructor + virtual ~Output() {} + +public: + /// @brief Shared Pointer to an Output + typedef shared_ptr Ptr; + /// @brief List of Output objects + typedef std::vector Vector; + + /** + * @brief Output the Log + * + * @param[in] aChannelPtr The underlying Channel of the Log + * @param[in] aLog The Log to output + */ + virtual void output(const Channel::Ptr& aChannelPtr, const Log& aLog) const = 0; + + /// @brief Return the type name of the Output object + inline const char* name() const { + return typeid(this).name(); + } +}; + + +} // namespace Log diff --git a/LoggerCpp/include/LoggerCpp/OutputConsole.h b/LoggerCpp/include/LoggerCpp/OutputConsole.h new file mode 100644 index 0000000..492e674 --- /dev/null +++ b/LoggerCpp/include/LoggerCpp/OutputConsole.h @@ -0,0 +1,62 @@ +/** + * @file OutputConsole.h + * @ingroup LoggerCpp + * @brief Output to the standard console using fprintf() with stdout + * + * Copyright (c) 2013 Sebastien Rombauts (sebastien.rombauts@gmail.com) + * + * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt + * or copy at http://opensource.org/licenses/MIT) + */ +#pragma once + +#include "LoggerCpp/Output.h" +#include "LoggerCpp/Config.h" + + +namespace Log { + + +/** + * @brief Output to the standard console using fprintf() with stdout + * @ingroup LoggerCpp + */ +class OutputConsole : public Output { +public: + /// @brief Constructor : no config + explicit OutputConsole(const Config::Ptr& aConfigPtr); + + /// @brief Destructor + virtual ~OutputConsole(); + +#ifdef _WIN32 + /** + * @brief Convert a Level to a Win32 console color text attribute + * + * @param[in] aLevel Log severity Level to convert + * + * @return Win32 console color text attribute + */ + static unsigned short toWin32Attribute(Log::Level aLevel); +#else // _WIN32 + /** + * @brief Convert a Level to an ANSI escape color code + * + * @param[in] aLevel Log severity Level to convert + * + * @return ANSI escape code for console color output + */ + static unsigned int toEscapeCode(Log::Level aLevel); +#endif // _WIN32 + + /** + * @brief Output the Log to the standard console using fprintf + * + * @param[in] aChannelPtr The underlying Channel of the Log + * @param[in] aLog The Log to output + */ + virtual void output(const Channel::Ptr& aChannelPtr, const Log& aLog) const; +}; + + +} // namespace Log diff --git a/LoggerCpp/include/LoggerCpp/OutputDebug.h b/LoggerCpp/include/LoggerCpp/OutputDebug.h new file mode 100644 index 0000000..13bbf94 --- /dev/null +++ b/LoggerCpp/include/LoggerCpp/OutputDebug.h @@ -0,0 +1,42 @@ +/** + * @file OutputDebug.h + * @ingroup LoggerCpp + * @brief Output to the Visual Studio debugger using OutputDebugString() + * + * Copyright (c) 2013 Sebastien Rombauts (sebastien.rombauts@gmail.com) + * + * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt + * or copy at http://opensource.org/licenses/MIT) + */ +#pragma once + +#include "LoggerCpp/Output.h" +#include "LoggerCpp/Config.h" + + +namespace Log { + + +/** + * @brief Output to the Visual Studio debugger using OutputDebugString() + * @ingroup LoggerCpp + */ +class OutputDebug : public Output { +public: + /// @brief Constructor : no config + explicit OutputDebug(const Config::Ptr& aConfigPtr); + + /// @brief Destructor + virtual ~OutputDebug(); + + /** + * @brief Output the Log to the Visual Studio debugger using OutputDebugString() + * + * @param[in] aChannelPtr The underlying Channel of the Log + * @param[in] aLog The Log to output + */ + virtual void output(const Channel::Ptr& aChannelPtr, const Log& aLog) const; +}; + + +} // namespace Log diff --git a/LoggerCpp/include/LoggerCpp/OutputFile.h b/LoggerCpp/include/LoggerCpp/OutputFile.h new file mode 100644 index 0000000..1012e44 --- /dev/null +++ b/LoggerCpp/include/LoggerCpp/OutputFile.h @@ -0,0 +1,84 @@ +/** + * @file OutputFile.h + * @ingroup LoggerCpp + * @brief Output to the a file using fprintf + * + * Copyright (c) 2013 Sebastien Rombauts (sebastien.rombauts@gmail.com) + * + * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt + * or copy at http://opensource.org/licenses/MIT) + */ +#pragma once + +#include "LoggerCpp/Output.h" +#include "LoggerCpp/Config.h" + +#include + + +namespace Log { + + +/** + * @brief Output to the standard console using fprintf + * @ingroup LoggerCpp + */ +class OutputFile : public Output { +public: + /** + * @brief Constructor : open the output file + * + * @param[in] aConfigPtr Config the output file with "filename" + */ + explicit OutputFile(const Config::Ptr& aConfigPtr); + + /// @brief Destructor : close the file + virtual ~OutputFile(); + + /** + * @brief Output the Log to the standard console using fprintf + * + * @param[in] aChannelPtr The underlying Channel of the Log + * @param[in] aLog The Log to output + */ + virtual void output(const Channel::Ptr& aChannelPtr, const Log& aLog) const; + +private: + /// @brief Open the log file + void open() const; + /// @brief Close the log file + void close() const; + /// @brief Rotate the log file : close, remove, rename, open + void rotate() const; + +private: + mutable FILE* mpFile; ///< @brief File pointer (mutable to be modified in the const output method) + mutable long mSize; ///< @brief Current size of the log file (mutable to be modified in the const output method) + + /** + * @brief "max_startup_size" : Size of the file above which to create a new file instead of appending to it (at startup). + * + * Default (0) creates a new file at each startup (never append to an existing one). + */ + long mMaxStartupSize; + + /** + * @brief "max_size" : Size of the file above which to create a new file instead of appending to it (at runtime). + * + * Default (1024*1024=1Mo) creates a new file each time the current one grow above 1Mo. + */ + long mMaxSize; + + /** + * @brief "filename" : Name of the log file + */ + std::string mFilename; + + /** + * @brief "filename_old" : Name of the log file renamed after max_size is reach + */ + std::string mFilenameOld; +}; + + +} // namespace Log diff --git a/LoggerCpp/include/LoggerCpp/Utils.h b/LoggerCpp/include/LoggerCpp/Utils.h new file mode 100644 index 0000000..9ae0780 --- /dev/null +++ b/LoggerCpp/include/LoggerCpp/Utils.h @@ -0,0 +1,78 @@ +/** + * @file Utils.h + * @ingroup Utils + * @brief Shared utility macros and functions. + * + * Copyright (c) 2013 Sebastien Rombauts (sebastien.rombauts@gmail.com) + * + * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt + * or copy at http://opensource.org/licenses/MIT) + */ +/** + * @defgroup Utils Utils + * @brief Shared utilities. + */ +#pragma once + +/** + * @brief Shared utilities. + * @ingroup Utils Utils + */ +namespace Utils { +} // namespace Utils + +#include + +/** + * @brief A macro to disallow the copy constructor and operator= functions. + * + * This should be used in the private: declarations for a class + * + * @param[in] TypeName Class name to protect + */ +#define DISALLOW_COPY_AND_ASSIGN(TypeName) \ + TypeName(const TypeName&); \ + void operator=(const TypeName&) + +#ifdef _MSC_VER +#if _MSC_VER < 1600 +/// A macro to enable the use of the nullptr keyword (NULL on older MSVC compilers, as they does not accept "nullptr_t") +#ifndef nullptr +#define nullptr NULL +#endif // nullptr +#endif // _MSC_VER < 1600 +#else // _MSC_VER +#if (__cplusplus < 201103L) && !defined(__GXX_EXPERIMENTAL_CXX0X__) // before C++11 on GCC4.7 and Visual Studio 2010 +#ifndef HAVE_NULLPTR +#define HAVE_NULLPTR ///< A macro to avoid double definition of nullptr +/** + * @brief nullptr_t is the type of the null pointer literal, nullptr. +*/ +class nullptr_t { +public: + template + inline operator T* () const { ///< convertible to any type of null non-member pointer... + return 0; + } + + template + inline operator T C::* () const { ///< convertible to any type of null member pointer... + return 0; + } + +private: + void operator&() const; ///< Can't take address of nullptr NOLINT +}; + +/** + * @brief Better way to enable nullptr on older GCC/Clang compilers +*/ +const nullptr_t nullptr = {}; +#endif // HAVE_NULLPTR +#endif // (__cplusplus < 201103L) && !defined(__GXX_EXPERIMENTAL_CXX0X__) +#endif // _MSC_VER + +// A macro for snprintf support in Visual Studio +#if _MSC_VER +#define snprintf _snprintf +#endif diff --git a/LoggerCpp/include/LoggerCpp/shared_ptr.hpp b/LoggerCpp/include/LoggerCpp/shared_ptr.hpp new file mode 100644 index 0000000..36583bf --- /dev/null +++ b/LoggerCpp/include/LoggerCpp/shared_ptr.hpp @@ -0,0 +1,305 @@ +/** + * @file shared_ptr.hpp + * @brief shared_ptr is a minimal implementation of smart pointer, a subset of the C++11 std::shared_ptr or boost::shared_ptr. + * + * This file includes "boost/shared_ptr.hpp" if LOGGER_USE_BOOST_SHARED_PTR is defined, + * or (or ) when C++11 (or experimental C++0x) is available, + * and imports the symbol "shared_ptr" inside the current namespace (ie. Log::shared_ptr). + * If no std::shared_ptr is available, it defines a minimal shared_ptr implementation. + * + * Copyright (c) 2013 Sebastien Rombauts (sebastien.rombauts@gmail.com) + * + * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt + * or copy at http://opensource.org/licenses/MIT) + */ +#pragma once + + +/// Compatibility with non-clang compilers. +#ifndef __has_feature + #define __has_feature(x) 0 +#endif + +// +// Try to detect the better shared_ptr to use, and then imports the symbol in the current namespace +// => if you include this "shared_ptr.hpp" file inside your own namespace you will +// get a kind of universal easy to use "shared_ptr" type +// +#ifdef LOGGER_USE_BOOST_SHARED_PTR + // Use Boost only if explicitly told + #include + namespace Log { + using boost::shared_ptr; + } // namespace Log +// Detect whether the compiler supports C++11 shared_ptr or its TR1 pre-version. +#elif (defined(__GNUC__) && \ + (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2)) && \ + defined(__GXX_EXPERIMENTAL_CXX0X__)) + // GCC 4.3 and following have std::shared_ptr support when called with -std=c++0x (or -std=c++11 starting with GCC 4.7) + #include + namespace Log { + using std::shared_ptr; + } // namespace Log +#elif (defined(__GNUC__) && (__GNUC__ == 4) && defined(__GXX_EXPERIMENTAL_CXX0X__)) + // GCC 4.0/4.1/4.2 have std::shared_ptr support when when called with -std=c++0x + #include + namespace Log { + using std::tr1::shared_ptr; + } // namespace Log +#elif defined(__clang__) && __has_feature(cxx_nullptr) + // Clang 2.9 and above ? + #include + namespace Log { + using std::shared_ptr; + } // namespace Log +#elif defined(_MSC_VER) && (_MSC_VER >= 1600) + // Visual Studio 2010 compile by default in C++11 mode + #include + namespace Log { + using std::shared_ptr; + } // namespace Log +#elif defined(_MSC_VER) && (_MSC_VER >= 1500) + // Visual Studio 2008 : beware, TR1 is provided with the Service Pack 1 only ! + #include + namespace Log { + using std::tr1:shared_ptr; + } // namespace Log +#else + + +#include // NULL +#include // std::swap +#include + +// can be replaced by other error mechanism +#define SHARED_ASSERT(x) assert(x) + +namespace Log { + +/** + * @brief minimal implementation of smart pointer, a subset of the C++11 std::shared_ptr or boost::shared_ptr. + * + * shared_ptr is a smart pointer retaining ownership of an object through a provided pointer, + * and sharing this ownership with a reference counter. + * It destroys the object when the last shared pointer pointing to it is destroyed or reset. + */ +template +class shared_ptr +{ +public: + /// The type of the managed object, aliased as member type + typedef T element_type; + + /// @brief Default constructor + shared_ptr(void) throw() : // never throws + px(NULL), + pn(NULL) + { + } + /// @brief Constructor with the provided pointer to manage + explicit shared_ptr(T* p) : // may throw std::bad_alloc + //px(p), would be unsafe as acquire() may throw, which would call release() in destructor + pn(NULL) + { + acquire(p); // may throw std::bad_alloc + } + /// @brief Constructor to share ownership. Warning : to be used for pointer_cast only ! (does not manage two separate and pointers) + template + shared_ptr(const shared_ptr& ptr, T* p) : + //px(p), would be unsafe as acquire() may throw, which would call release() in destructor + pn(ptr.pn) + { + acquire(p); // may throw std::bad_alloc + } + /// @brief Copy constructor to convert from another pointer type + template + shared_ptr(const shared_ptr& ptr) throw() : // never throws (see comment below) + //px(ptr.px), + pn(ptr.pn) + { + SHARED_ASSERT((NULL == ptr.px) || (NULL != ptr.pn)); // must be cohérent : no allocation allowed in this path + acquire(static_cast::element_type*>(ptr.px)); // will never throw std::bad_alloc + } + /// @brief Copy constructor (used by the copy-and-swap idiom) + shared_ptr(const shared_ptr& ptr) throw() : // never throws (see comment below) + //px(ptr.px), + pn(ptr.pn) + { + SHARED_ASSERT((NULL == ptr.px) || (NULL != ptr.pn)); // must be cohérent : no allocation allowed in this path + acquire(ptr.px); // will never throw std::bad_alloc + } + /// @brief Assignment operator using the copy-and-swap idiom (copy constructor and swap method) + shared_ptr& operator=(shared_ptr ptr) throw() // never throws + { + swap(ptr); + return *this; + } + /// @brief the destructor releases its ownership + inline ~shared_ptr(void) throw() // never throws + { + release(); + } + /// @brief this reset releases its ownership + inline void reset(void) throw() // never throws + { + release(); + } + /// @brief this reset release its ownership and re-acquire another one + void reset(T* p) throw() // may throw std::bad_alloc + { + SHARED_ASSERT((NULL == p) || (px != p)); // auto-reset not allowed + release(); + acquire(p); // may throw std::bad_alloc + } + + /// @brief Swap method for the copy-and-swap idiom (copy constructor and swap method) + void swap(shared_ptr& lhs) throw() // never throws + { + // Would be nice to enable use of ustl::swap by define + std::swap(px, lhs.px); + std::swap(pn, lhs.pn); + } + + // reference counter operations : + inline operator bool() const throw() // never throws + { + return (0 < use_count()); + } + inline bool unique(void) const throw() // never throws + { + return (1 == use_count()); + } + long use_count(void) const throw() // never throws + { + long count = 0; + if (NULL != pn) + { + count = *pn; + } + return count; + } + + // underlying pointer operations : + inline T& operator*() const throw() // never throws + { + SHARED_ASSERT(NULL != px); + return *px; + } + inline T* operator->() const throw() // never throws + { + SHARED_ASSERT(NULL != px); + return px; + } + inline T* get(void) const throw() // never throws + { + // no assert, car return NULL + return px; + } + +private: + /// @brief acquire/share the ownership of the px pointer, initializing the reference counter + void acquire(T* p) // may throw std::bad_alloc + { + if (NULL != p) + { + if (NULL == pn) + { + try + { + pn = new long(1); // may throw std::bad_alloc + } + catch (std::bad_alloc&) + { + delete p; + throw; // rethrow the std::bad_alloc + } + } + else + { + ++(*pn); + } + } + // here it is safe to acquire the ownership of the provided raw pointer, where exception cannot be thrown any more + px = p; + } + + /// @brief release the ownership of the px pointer, destroying the object when appropriate + void release(void) throw() // never throws + { + if (NULL != pn) + { + --(*pn); + if (0 == *pn) + { + delete px; + delete pn; + } + px = NULL; + pn = NULL; + } + } + +private: + // This allow pointer_cast functions to share the reference counter between different shared_ptr types + template + friend class shared_ptr; + +private: + T* px; //!< Native pointer + long* pn; //!< Reference counter +}; + + +// comparaison operators +template inline bool operator==(const shared_ptr& l, const shared_ptr& r) throw() // never throws +{ + return (l.get() == r.get()); +} +template inline bool operator!=(const shared_ptr& l, const shared_ptr& r) throw() // never throws +{ + return (l.get() != r.get()); +} +template inline bool operator<=(const shared_ptr& l, const shared_ptr& r) throw() // never throws +{ + return (l.get() <= r.get()); +} +template inline bool operator<(const shared_ptr& l, const shared_ptr& r) throw() // never throws +{ + return (l.get() < r.get()); +} +template inline bool operator>=(const shared_ptr& l, const shared_ptr& r) throw() // never throws +{ + return (l.get() >= r.get()); +} +template inline bool operator>(const shared_ptr& l, const shared_ptr& r) throw() // never throws +{ + return (l.get() > r.get()); +} + + + +// static cast of shared_ptr +template +shared_ptr static_pointer_cast(const shared_ptr& ptr) // never throws +{ + return shared_ptr(ptr, static_cast::element_type*>(ptr.get())); +} + +// dynamic cast of shared_ptr +template +shared_ptr dynamic_pointer_cast(const shared_ptr& ptr) // never throws +{ + T* p = dynamic_cast::element_type*>(ptr.get()); + if (NULL != p) + { + return shared_ptr(ptr, p); + } + else + { + return shared_ptr(); + } +} + +} // namespace Log + +#endif diff --git a/LoggerCpp/src/Config.cpp b/LoggerCpp/src/Config.cpp new file mode 100644 index 0000000..669d2a5 --- /dev/null +++ b/LoggerCpp/src/Config.cpp @@ -0,0 +1,65 @@ +/** + * @file Config.cpp + * @ingroup LoggerCpp + * @brief Configuration for an Output object + * + * Copyright (c) 2013 Sebastien Rombauts (sebastien.rombauts@gmail.com) + * + * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt + * or copy at http://opensource.org/licenses/MIT) + */ + +#include "LoggerCpp/Config.h" +#include "LoggerCpp/Exception.h" + +#include + + +namespace Log { + + +// Constructor +Config::Config(const char* apName) : + mName(apName) { +} + +// Destructor +Config::~Config(void) { +} + +// Get a string value +const char* Config::get(const char* apKey, const char* apDefaultValue) const { + const char* pValue; + Config::Values::const_iterator iValue = mValues.find(apKey); + if (mValues.end() != iValue) { + pValue = iValue->second.c_str(); + } else { + pValue = apDefaultValue; + } + return pValue; +} + +// Get a string value +long Config::get(const char* apKey, long aDefaultValue) const { + long value; + Config::Values::const_iterator iValue = mValues.find(apKey); + if (mValues.end() != iValue) { + value = atol(iValue->second.c_str()); + } else { + value = aDefaultValue; + } + return value; +} + +// Create the Config for a new Output +void Config::addOutput(Vector& aConfigList, const char* apOutputName) { + Log::Config::Ptr configPtr(new Log::Config(apOutputName)); + aConfigList.push_back(configPtr); +} + +// Set an option for the last added Output +void Config::setOption(Vector& aConfigList, const char* apKey, const char* apValue) { + (*aConfigList.back()).setValue(apKey, apValue); +} + +} // namespace Log diff --git a/LoggerCpp/src/DateTime.cpp b/LoggerCpp/src/DateTime.cpp new file mode 100644 index 0000000..876f839 --- /dev/null +++ b/LoggerCpp/src/DateTime.cpp @@ -0,0 +1,69 @@ +/** + * @file DateTime.cpp + * @ingroup LoggerCpp + * @brief Current time precise to the millisecond. + * + * Copyright (c) 2013 Sebastien Rombauts (sebastien.rombauts@gmail.com) + * + * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt + * or copy at http://opensource.org/licenses/MIT) + */ + +#include "LoggerCpp/DateTime.h" +#include "LoggerCpp/Utils.h" + +#ifdef WIN32 +#include +#else +#include +#include +#endif + +namespace Log { + + +/// Constructor +DateTime::DateTime(void) : + year(0), + month(0), + day(0), + hour(0), + minute(0), + second(0), + ms(0), + us(0) { +} + + +/// Set to current time +void DateTime::make(void) { +#ifdef WIN32 + SYSTEMTIME now; + GetLocalTime(&now); + + year = now.wYear; + month = now.wMonth; + day = now.wDay; + hour = now.wHour; + minute = now.wMinute; + second = now.wSecond; + ms = now.wMilliseconds; + us = 0; +#else + struct timeval now; + gettimeofday(&now, nullptr); + struct tm* timeinfo = localtime(&now.tv_sec); + + year = timeinfo->tm_year + 1900; + month = timeinfo->tm_mon + 1; + day = timeinfo->tm_mday; + hour = timeinfo->tm_hour; + minute = timeinfo->tm_min; + second = timeinfo->tm_sec; + ms = now.tv_usec / 1000; + us = now.tv_usec % 1000; +#endif +} + + +} // namespace Log diff --git a/LoggerCpp/src/Log.cpp b/LoggerCpp/src/Log.cpp new file mode 100644 index 0000000..0db49e2 --- /dev/null +++ b/LoggerCpp/src/Log.cpp @@ -0,0 +1,75 @@ +/** + * @file Log.cpp + * @ingroup LoggerCpp + * @brief A RAII (private) log object constructed by the Logger class + * + * Copyright (c) 2013 Sebastien Rombauts (sebastien.rombauts@gmail.com) + * + * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt + * or copy at http://opensource.org/licenses/MIT) + */ + +#include "LoggerCpp/Log.h" +#include "LoggerCpp/Logger.h" + +#include + + +namespace Log { + + +// Construct a RAII (private) log object for the Logger class +Log::Log(const Logger& aLogger, Level aSeverity) : + mLogger(aLogger), + mSeverity(aSeverity), + mpStream(nullptr) { + // Construct a stream only if the severity of the Log is above its Logger Log::Level + if (aSeverity >= aLogger.getLevel()) { + mpStream = new(std::ostringstream); + } +} + +// Destructor : output the Log string stream +Log::~Log(void) { + if (nullptr != mpStream) { + mTime.make(); + mLogger.output(*this); + + delete mpStream; + mpStream = nullptr; + } +} + +// Convert a Level to its string representation +const char* Log::toString(Log::Level aLevel) { + const char* pString = nullptr; + + switch (aLevel) { + case Log::eDebug: pString = "DBUG"; break; + case Log::eInfo: pString = "INFO"; break; + case Log::eNotice: pString = "NOTE"; break; + case Log::eWarning: pString = "WARN"; break; + case Log::eError: pString = "EROR"; break; + case Log::eCritic: pString = "CRIT"; break; + default: pString = "????"; break; + } + + return pString; +} + +// Convert a string representation of a Level to its corresponding value +Log::Level Log::toLevel(const char* apLevel) { + Log::Level level; + + if (0 == strncmp(apLevel, "DBUG", 4)) level = Log::eDebug; + else if (0 == strncmp(apLevel, "INFO", 4)) level = Log::eInfo; + else if (0 == strncmp(apLevel, "NOTE", 4)) level = Log::eNotice; + else if (0 == strncmp(apLevel, "WARN", 4)) level = Log::eWarning; + else if (0 == strncmp(apLevel, "EROR", 4)) level = Log::eError; + else /* (0 == strncmp(apLevel, "CRIT", 4)*/ level = Log::eCritic; // NOLINT(whitespace/newline) + + return level; +} + + +} // namespace Log diff --git a/LoggerCpp/src/Logger.cpp b/LoggerCpp/src/Logger.cpp new file mode 100644 index 0000000..7ba4c74 --- /dev/null +++ b/LoggerCpp/src/Logger.cpp @@ -0,0 +1,61 @@ +/** + * @file Logger.cpp + * @ingroup LoggerCpp + * @brief A simple thread-safe Logger class + * + * Copyright (c) 2013 Sebastien Rombauts (sebastien.rombauts@gmail.com) + * + * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt + * or copy at http://opensource.org/licenses/MIT) + */ + +#include "LoggerCpp/Logger.h" +#include "LoggerCpp/Manager.h" + +#include + + +namespace Log { + + +// Initialize a Logger utility object +Logger::Logger(const char* apChannelName) { + assert(nullptr != apChannelName); + + mChannelPtr = Manager::get(apChannelName); + + assert(mChannelPtr); +} + +// Non virtual destructor +Logger::~Logger(void) { +} + +// Utility const method to produce Log objets, used to collect the stream to output +Log Logger::debug(void) const { + return Log(*this, Log::eDebug); +} +Log Logger::info(void) const { + return Log(*this, Log::eInfo); +} +Log Logger::notice(void) const { + return Log(*this, Log::eNotice); +} +Log Logger::warning(void) const { + return Log(*this, Log::eWarning); +} +Log Logger::error(void) const { + return Log(*this, Log::eError); +} +Log Logger::critic(void) const { + return Log(*this, Log::eCritic); +} + +// To be used only by the Log class +void Logger::output(const Log& aLog) const { + Manager::output(mChannelPtr, aLog); +} + + +} // namespace Log + diff --git a/LoggerCpp/src/Manager.cpp b/LoggerCpp/src/Manager.cpp new file mode 100644 index 0000000..e87086a --- /dev/null +++ b/LoggerCpp/src/Manager.cpp @@ -0,0 +1,140 @@ +/** + * @file Manager.cpp + * @ingroup LoggerCpp + * @brief The static class that manage the registered channels and outputs + * + * Copyright (c) 2013 Sebastien Rombauts (sebastien.rombauts@gmail.com) + * + * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt + * or copy at http://opensource.org/licenses/MIT) + */ + +#include "LoggerCpp/Manager.h" +#include "LoggerCpp/Exception.h" + +#include "LoggerCpp/OutputConsole.h" +#include "LoggerCpp/OutputFile.h" +#ifdef WIN32 +#include "LoggerCpp/OutputDebug.h" +#endif + +#include +#include +#include + +namespace Log { + + +Channel::Map Manager::mChannelMap; +Output::Vector Manager::mOutputList; +Log::Level Manager::mDefaultLevel = Log::eDebug; + + +// Create and configure the Output objects. +void Manager::configure(const Config::Vector& aConfigList) { + // List of all Output class ; those names are in the form + // - "class Log::OutputConsole" under Visual Studio 2010 + // - "N3Log13OutputConsoleE" under GCC + std::string outputConsole = typeid(OutputConsole).name(); + std::string outputFile = typeid(OutputFile).name(); +#ifdef WIN32 + std::string outputDebug = typeid(OutputDebug).name(); +#endif + + Config::Vector::const_iterator iConfig; + for ( iConfig = aConfigList.begin(); + iConfig != aConfigList.end(); + ++iConfig) { + Output::Ptr outputPtr; + const std::string& configName = (*iConfig)->getName(); + + // Compare the provided Output name with the known class name + if (std::string::npos != outputConsole.find(configName)) { + outputPtr.reset(new OutputConsole((*iConfig))); + } else if (std::string::npos != outputFile.find(configName)) { + outputPtr.reset(new OutputFile((*iConfig))); +#ifdef WIN32 + } else if (std::string::npos != outputDebug.find(configName)) { + outputPtr.reset(new OutputDebug((*iConfig))); +#endif + } else { + LOGGER_THROW("Unknown Output name '" << configName << "'"); + } + mOutputList.push_back(outputPtr); + } +} + +// Destroy the Output objects. +void Manager::terminate(void) { + // This effectively destroys the Output objects + mOutputList.clear(); +} + +// Return the Channel corresponding to the provided name +Channel::Ptr Manager::get(const char* apChannelName) { + Channel::Ptr ChannelPtr; + Channel::Map::iterator iChannelPtr = mChannelMap.find(apChannelName); + + if (mChannelMap.end() != iChannelPtr) { + ChannelPtr = iChannelPtr->second; + } else { + /// @todo Add a basic thread-safety security (throw if multiple threads create Loggers) + ChannelPtr.reset(new Channel(apChannelName, mDefaultLevel)); + mChannelMap[apChannelName] = ChannelPtr; + } + + return ChannelPtr; +} + +// Output the Log to all the active Output objects. +void Manager::output(const Channel::Ptr& aChannelPtr, const Log& aLog) { + Output::Vector::iterator iOutputPtr; + if (mOutputList.size() == 0) { + OutputConsole output(NULL); + output.output(aChannelPtr, aLog); + } + + + for ( iOutputPtr = mOutputList.begin(); + iOutputPtr != mOutputList.end(); + ++iOutputPtr) { + (*iOutputPtr)->output(aChannelPtr, aLog); + } +} + +// Serialize the current Log::Level of Channel objects and return them as a Config instance +Config::Ptr Manager::getChannelConfig(void) { + Config::Ptr ConfigPtr(new Config("ChannelConfig")); + + Channel::Map::const_iterator iChannel; + for (iChannel = mChannelMap.begin(); + iChannel != mChannelMap.end(); + ++iChannel) { + ConfigPtr->setValue(iChannel->first.c_str(), Log::toString(iChannel->second->getLevel())); + } + + return ConfigPtr; +} + +// Set the Log::Level of Channel objects from the provided Config instance +void Manager::setChannelConfig(const Config::Ptr& aConfigPtr) { + const Config::Values& ConfigValues = aConfigPtr->getValues(); + + Config::Values::const_iterator iValue; + for (iValue = ConfigValues.begin(); + iValue != ConfigValues.end(); + ++iValue) { + Manager::get(iValue->first.c_str())->setLevel(Log::toLevel(iValue->second.c_str())); + } +} + +void Manager::setCustomLogger(Output *logger) { + mOutputList.clear(); + Output::Ptr outputPtr; + outputPtr.reset(logger); + mOutputList.push_back(outputPtr); +} + + +} // namespace Log + diff --git a/LoggerCpp/src/OutputConsole.cpp b/LoggerCpp/src/OutputConsole.cpp new file mode 100644 index 0000000..7e6f7d9 --- /dev/null +++ b/LoggerCpp/src/OutputConsole.cpp @@ -0,0 +1,94 @@ +/** + * @file OutputConsole.cpp + * @ingroup LoggerCpp + * @brief Output to the standard console using fprintf() with stdout + * + * Copyright (c) 2013 Sebastien Rombauts (sebastien.rombauts@gmail.com) + * + * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt + * or copy at http://opensource.org/licenses/MIT) + */ + +#include "LoggerCpp/OutputConsole.h" + +#include + +#ifdef _WIN32 +#include +#endif + +namespace Log { + + +// Constructor +OutputConsole::OutputConsole(const Config::Ptr& aConfigPtr) { + (void)aConfigPtr; +} + +// Destructor +OutputConsole::~OutputConsole() { +} + +#ifdef _WIN32 + +// Convert a Level to a Win32 console color text attribute +unsigned short OutputConsole::toWin32Attribute(Log::Level aLevel) { + unsigned short code; + + switch (aLevel) { + case Log::eDebug : code = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; break; // white + case Log::eInfo : code = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY; break; + case Log::eNotice : code = FOREGROUND_GREEN; break; // green + case Log::eWarning : code = FOREGROUND_RED | FOREGROUND_GREEN; break; // orange + case Log::eError : code = FOREGROUND_RED; break; // red + case Log::eCritic : code = FOREGROUND_RED | FOREGROUND_INTENSITY; break; // light red + default : code = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; break; // white + } + + return (code); +} + +#else // _WIN32 + +// Convert a Level to its ANSI escape color code +unsigned int OutputConsole::toEscapeCode(Log::Level aLevel) { + unsigned int code; + + switch (aLevel) { + case Log::eDebug: code = 34; break; // 34=blue + case Log::eInfo: code = 39; break; // 39=white + case Log::eNotice: code = 32; break; // 32=green + case Log::eWarning: code = 33; break; // 33=orange + case Log::eError: code = 31; break; // 31=red + case Log::eCritic: code = 95; break; // 95=magenta + default: code = 39; break; // 39=white (reset to default) + } + + return code; +} + +#endif // _WIN32 + +// Output the Log to the standard console using fprintf +void OutputConsole::output(const Channel::Ptr& aChannelPtr, const Log& aLog) const { + const DateTime& time = aLog.getTime(); + + // uses fprintf for atomic thread-safe operation +#ifdef _WIN32 + SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), toWin32Attribute(aLog.getSeverity())); + fprintf(stdout, "%.4u-%.2u-%.2u %.2u:%.2u:%.2u.%.3u %-12s %s %s\n", +#else // _WIN32 + fprintf(stdout, "\x1B[%02um%.4u-%.2u-%.2u %.2u:%.2u:%.2u.%.3u %-12s %s %s\x1b[39m\n", + toEscapeCode(aLog.getSeverity()), +#endif // _WIN32 + time.year, time.month, time.day, + time.hour, time.minute, time.second, time.ms, + aChannelPtr->getName().c_str(), Log::toString(aLog.getSeverity()), (aLog.getStream()).str().c_str()); +#ifdef _WIN32 + SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); +#endif // _WIN32 + fflush(stdout); +} + + +} // namespace Log diff --git a/LoggerCpp/src/OutputDebug.cpp b/LoggerCpp/src/OutputDebug.cpp new file mode 100644 index 0000000..1336d22 --- /dev/null +++ b/LoggerCpp/src/OutputDebug.cpp @@ -0,0 +1,49 @@ +/** + * @file OutputDebug.cpp + * @ingroup LoggerCpp + * @brief Output to the Visual Studio debugger using OutputDebugString() + * + * Copyright (c) 2013 Sebastien Rombauts (sebastien.rombauts@gmail.com) + * + * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt + * or copy at http://opensource.org/licenses/MIT) + */ + +#ifdef WIN32 + +#include "LoggerCpp/OutputDebug.h" + +#include + +#include + + +namespace Log { + + +// Constructor +OutputDebug::OutputDebug(const Config::Ptr& aConfigPtr) { +} + +// Destructor +OutputDebug::~OutputDebug() { +} + +// Output the Log to the Visual Studio debugger using OutputDebugString() +void OutputDebug::output(const Channel::Ptr& aChannelPtr, const Log& aLog) const { + const DateTime& time = aLog.getTime(); + char buffer[256]; + + // uses snprintf for atomic thread-safe operation + _snprintf(buffer, sizeof(buffer), "%.4u-%.2u-%.2u %.2u:%.2u:%.2u.%.3u %-12s %s %s\n", + time.year, time.month, time.day, + time.hour, time.minute, time.second, time.ms, + aChannelPtr->getName().c_str(), Log::toString(aLog.getSeverity()), (aLog.getStream()).str().c_str()); + buffer[255] = '\0'; + OutputDebugStringA(buffer); +} + + +} // namespace Log + +#endif // WIN32 diff --git a/LoggerCpp/src/OutputFile.cpp b/LoggerCpp/src/OutputFile.cpp new file mode 100644 index 0000000..7949651 --- /dev/null +++ b/LoggerCpp/src/OutputFile.cpp @@ -0,0 +1,101 @@ +/** + * @file OutputFile.cpp + * @ingroup LoggerCpp + * @brief Output to the standard console using printf + * + * Copyright (c) 2013 Sebastien Rombauts (sebastien.rombauts@gmail.com) + * + * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt + * or copy at http://opensource.org/licenses/MIT) + */ + +#include "LoggerCpp/OutputFile.h" +#include "LoggerCpp/Exception.h" + +#include +#include +#include + + +namespace Log { + + +// Open the output file +OutputFile::OutputFile(const Config::Ptr& aConfigPtr) : + mpFile(nullptr) { + assert(aConfigPtr); + + mMaxStartupSize = aConfigPtr->get("max_startup_size", (long)0); + mMaxSize = aConfigPtr->get("max_size", (long)1024*1024); + mFilename = aConfigPtr->get("filename", "log.txt"); + mFilenameOld = aConfigPtr->get("filename_old", "log.old.txt"); + + // Test the size of the existing log file, rename it and open a new one if needed + struct stat statFile; + int ret = stat(mFilename.c_str(), &statFile); + if (0 == ret) { + mSize = statFile.st_size; + } + + if (mSize > mMaxStartupSize) { + rotate(); + } else { + open(); + } +} + +// Close the file +OutputFile::~OutputFile() { + close(); +} + +// Open the file +void OutputFile::open() const { + mpFile = fopen(mFilename.c_str(), "ab"); + if (nullptr == mpFile) { + LOGGER_THROW("file \"" << mFilename << "\" not opened"); + } +} + +// Close the file if it is opened +void OutputFile::close() const { + if (nullptr != mpFile) { + fclose(mpFile); + mpFile = nullptr; + mSize = 0; + } +} + +// Rotate a file : close, remove, rename, open +void OutputFile::rotate() const { + close(); + + remove(mFilenameOld.c_str()); + rename(mFilename.c_str(), mFilenameOld.c_str()); + + open(); +} + +// Output the Log to the standard console using printf +void OutputFile::output(const Channel::Ptr& aChannelPtr, const Log& aLog) const { + const DateTime& time = aLog.getTime(); + + if (mSize > mMaxSize) { + rotate(); + } + + if (nullptr != mpFile) { + // uses fprintf for atomic thread-safe operation + int nbWritten = fprintf(mpFile, "%.4u-%.2u-%.2u %.2u:%.2u:%.2u.%.3u %-12s %s %s\n", + time.year, time.month, time.day, + time.hour, time.minute, time.second, time.ms, + aChannelPtr->getName().c_str(), Log::toString(aLog.getSeverity()), + (aLog.getStream()).str().c_str()); + fflush(stdout); + + mSize += nbWritten; + } +} + + +} // namespace Log diff --git a/fl/fuzzylite.h b/fl/fuzzylite.h index d6d1f6d..3336964 100644 --- a/fl/fuzzylite.h +++ b/fl/fuzzylite.h @@ -27,6 +27,7 @@ #include #include #include +#include "LoggerCpp/LoggerCpp.h" #ifndef FL_VERSION #define FL_VERSION "?" @@ -42,13 +43,13 @@ namespace fl { #ifdef FL_USE_FLOAT - typedef float scalar; + typedef float scalar; #else - typedef double scalar; + typedef double scalar; #endif - static const scalar nan = std::numeric_limits::quiet_NaN(); - static const scalar inf = std::numeric_limits::infinity(); + static const scalar nan = std::numeric_limits::quiet_NaN(); + static const scalar inf = std::numeric_limits::infinity(); } #define FL__FILE__ std::string(__FILE__).substr(std::string(FL_BUILD_PATH).size()) @@ -58,8 +59,8 @@ namespace fl { #define FL_AT FL__FILE__, __LINE__, __FUNCTION__ -#define FL_LOG(message) if (fl::fuzzylite::logging()){std::cout << FL_LOG_PREFIX << message << std::endl;} -#define FL_LOGP(message) if (fl::fuzzylite::logging()){std::cout << message << std::endl;} +#define FL_LOG(message) if (fl::fuzzylite::logging()){fl::fuzzylite::logger->info() << FL_LOG_PREFIX << message /*<< std::endl */;} +#define FL_LOGP(message) if (fl::fuzzylite::logging()){fl::fuzzylite::logger->info() << message /* << std::endl */;} #ifndef FL_DEBUG #define FL_DEBUG false @@ -69,9 +70,9 @@ namespace fl { #define FL_END_DEBUG_BLOCK } #define FL_DBG(message) FL_BEGIN_DEBUG_BLOCK \ - std::cout << FL__FILE__ << "::" << __FUNCTION__ << "[" << __LINE__ << "]:" \ - << message << std::endl;\ - FL_END_DEBUG_BLOCK + fl::fuzzylite::logger->debug() << FL__FILE__ << "::" << __FUNCTION__ << "[" << __LINE__ << "]:" \ + << message /*<< std::endl*/;\ + FL_END_DEBUG_BLOCK //class FL_EXPORT is require to build DLLs in Windows. #ifdef FL_WINDOWS @@ -108,43 +109,44 @@ namespace fl { namespace fl { - class FL_EXPORT fuzzylite { - protected: - static int _decimals; - static scalar _macheps; - static bool _debug; - static bool _logging; + class FL_EXPORT fuzzylite { + protected: + static int _decimals; + static scalar _macheps; + static bool _debug; + static bool _logging; - public: - static std::string name(); - static std::string fullname(); - static std::string version(); - static std::string longVersion(); - static std::string author(); - static std::string date(); - static std::string platform(); - static std::string configuration(); + public: + static Log::Logger *logger; + static std::string name(); + static std::string fullname(); + static std::string version(); + static std::string longVersion(); + static std::string author(); - static std::string floatingPoint(); + static std::string date(); + static std::string platform(); + static std::string configuration(); - static bool debug(); - static void setDebug(bool debug); + static std::string floatingPoint(); - static int decimals(); - static void setDecimals(int decimals); + static bool debug(); + static void setDebug(bool debug); - static scalar macheps(); - static void setMachEps(scalar macheps); + static int decimals(); + static void setDecimals(int decimals); - static bool logging(); - static void setLogging(bool logging); - }; + static scalar macheps(); + static void setMachEps(scalar macheps); - bool icasecmp(const std::string& l, const std::string& r); - std::string toLower(std::string word); + static bool logging(); + static void setLogging(bool logging); + }; + + bool icasecmp(const std::string& l, const std::string& r); + std::string toLower(std::string word); } - #endif /* FL_FUZZYLITE_H */ diff --git a/src/fuzzylite.cpp b/src/fuzzylite.cpp index 98b38dd..f842231 100644 --- a/src/fuzzylite.cpp +++ b/src/fuzzylite.cpp @@ -31,6 +31,8 @@ namespace fl { scalar fuzzylite::_macheps = 1e-5; bool fuzzylite::_debug = FL_DEBUG; bool fuzzylite::_logging = true; + Log::Logger *fuzzylite::logger = NULL; + //Log::Logger *fuzzylite::logger = new Log::Logger("FuzzyLite"); std::string fuzzylite::name() { return "fuzzyliteNG"; @@ -89,6 +91,8 @@ namespace fl { } void fuzzylite::setDebug(bool debug) { + if (debug && !fl::fuzzylite::logger) + fl::fuzzylite::logger = new Log::Logger("FuzzyLite"); _debug = debug; } @@ -113,6 +117,9 @@ namespace fl { } void fuzzylite::setLogging(bool logging) { + if (logging && !fl::fuzzylite::logger) + fl::fuzzylite::logger = new Log::Logger("FuzzyLite"); + _logging = logging; } diff --git a/src/main.cpp b/src/main.cpp index 83fdf7e..a545900 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -22,15 +22,23 @@ #include "fl/Headers.h" -#include +#include #include #include #include #include #include +#include "LoggerCpp/LoggerCpp.h" using namespace fl; + + + + + + + /* void baz(){ int *x = (int*) - 1; // make a bad pointer @@ -184,9 +192,108 @@ void exportAllExamples(const std::string& from, const std::string& to) { } } +class TestLog : public Log::Output { + public: + explicit TestLog() { + }; + virtual ~TestLog() { + + } + virtual void output(const Log::Channel::Ptr& aChannelPtr, const Log::Log& aLog) const { + (void)aChannelPtr; + std::cout << "test: " << aLog.getStream().str() << std::endl; + } +}; + + int main(int argc, char** argv) { (void) argc; (void) argv; + + fl::fuzzylite::setLogging(true); + fl::fuzzylite::setDebug(true); + + Log::Config::Vector configList; +#if 0 + Log::Config::addOutput(configList, "OutputConsole"); + Log::Config::addOutput(configList, "OutputFile"); + Log::Config::setOption(configList, "filename", "log.txt"); + Log::Config::setOption(configList, "filename_old", "log.old.txt"); + Log::Config::setOption(configList, "max_startup_size", "0"); + Log::Config::setOption(configList, "max_size", "10000"); +#endif +#ifdef WIN32 + Log::Config::addOutput(configList, "OutputDebug"); +#endif + + // Create a Logger object, using a "Main.Example" Channel + Log::Logger logger22("Main.Example"); + + + logger22.warning() << "NO logs before configure()"; + + try + { + // Configure the Log Manager (create the Output objects) + //Log::Manager::configure(configList); + Log::Manager::setCustomLogger(new TestLog()); + } + catch (std::exception& e) + { + std::cerr << e.what(); + } + + // Test outputs of various kind of variables, and some common stream manipulations. + std::string str("string"); + unsigned int ui = 123; + double dbl = -0.023f; + logger22.debug() << "Variables ; '" << str << "', '" << ui << "', '" << dbl << "'"; + logger22.debug() << "Hexa = " << std::hex << 0x75af0 << " test"; + logger22.debug() << "Deci = " << std::right << std::setfill('0') << std::setw(8) << 76035 << " test"; + logger22.debug() << "sizeof(logger)=" << sizeof(logger22); + + // Test outputs of various severity Level + logger22.debug() << "Debug."; + logger22.info() << "Info."; + logger22.notice() << "Notice."; + logger22.warning()<< "Warning."; + logger22.error() << "Error."; + logger22.critic() << "Critic."; + + // Modify the output Level of the underlying Channel, and test various severity Level again + logger22.setLevel(Log::Log::eWarning); + logger22.debug() << "NO Debug."; // NO more debug logs + logger22.info() << "NO Info."; // NO more info logs + logger22.notice() << "NO Notice."; // NO more notice logs + logger22.warning()<< "Warning."; + logger22.error() << "Error."; + logger22.critic() << "Critic."; + + // Reset Level of the "Main.example" channel by its name + Log::Manager::get("Main.Example")->setLevel(Log::Log::eDebug); + + // Create other loggers, sharing the "Main.Example" Channel, and creating a new one + Log::Logger logger2("Main.Example"); + Log::Logger logger3("Main.Other"); + logger22.debug() << "First logger to the Channel"; + logger2.debug() << "Second logger to the Channel"; + logger3.debug() << "Third logger, other Channel"; + // Modify the Level of the "Main.example" channel by its name + Log::Manager::get("Main.Example")->setLevel(Log::Log::eInfo); + logger22.debug() << "first logger inhibited"; // NO more debug logs for this logger + logger2.debug() << "second logger also disabled"; // NO more debug logs (sharing the same underlying channel) + logger3.debug() << "third logger still active"; + // Reset the Level of the "Main.example" channel by its name + Log::Manager::get("Main.Example")->setLevel(Log::Log::eDebug); + logger22.debug() << "first logger re-activated"; + logger2.debug() << "second logger also re-activated"; + logger3.debug() << "third logger always active"; + + + + + + std::set_terminate(fl::Exception::terminate); std::set_unexpected(fl::Exception::terminate); signal(SIGSEGV, fl::Exception::signalHandler); @@ -194,8 +301,7 @@ int main(int argc, char** argv) { signal(SIGILL, fl::Exception::signalHandler); signal(SIGSEGV, fl::Exception::signalHandler); signal(SIGFPE, fl::Exception::signalHandler); - fl::fuzzylite::setLogging(true); - fl::fuzzylite::setDebug(true); + #ifdef FL_UNIX signal(SIGBUS, fl::Exception::signalHandler); signal(SIGPIPE, fl::Exception::signalHandler); @@ -213,7 +319,7 @@ int main(int argc, char** argv) { // return 0; // return Console::main(argc, argv); fl::Engine* engine = new fl::Engine("simple-dimmer"); - + fl::InputVariable* ambient = new fl::InputVariable; ambient->setName("Ambient"); ambient->setRange(0.000, 1.000); @@ -250,7 +356,7 @@ fl::Engine* engine = new fl::Engine("simple-dimmer"); power1->addTerm(new fl::Triangle("MEDIUM", 0.500, 1.500)); power1->addTerm(new fl::Triangle("HIGH", 1.000, 2.000)); engine->addOutputVariable(power1); - + fl::RuleBlock* ruleblock = new fl::RuleBlock; ruleblock->addRule(fl::Rule::parse("if Ambient1 is DARK and Ambient is Now(2:27pm) then Power is very HiGh", engine)); ruleblock->addRule(fl::Rule::parse("if Ambient is DARK then Power is HIGH", engine)); @@ -259,10 +365,10 @@ fl::Engine* engine = new fl::Engine("simple-dimmer"); ruleblock->addRule(fl::Rule::parse("if Ambient is BRIGHT then in 533m set Power is LOW and Power1 is HIGH", engine)); //# ruleblock->addRule(fl::Rule::parse("if Ambient is BRIGHT then in 5m Power is LOW", engine)); engine->addRuleBlock(ruleblock); - + //No Conjunction or Disjunction is needed engine->configure("AlgebraicProduct", "", "AlgebraicProduct", "AlgebraicSum", "Centroid"); - + std::string status; if (not engine->isReady(&status)) throw fl::Exception("Engine not ready. " @@ -283,18 +389,18 @@ fl::Engine* engine = new fl::Engine("simple-dimmer"); fl::scalar light = ambient->getMinimum() + i * (ambient->range() / 50); ambient->setInputValue(light); engine->process(); - FL_LOG("Ambient.input = " << fl::Op::str(light) << " -> " << - "Power.output = " << fl::Op::str(power->defuzzify()) << - " Timer: " << power->getTimer() << - " Power1.output = " << fl::Op::str(power1->defuzzify()) << + FL_LOG("Ambient.input = " << fl::Op::str(light) << " -> " << + "Power.output = " << fl::Op::str(power->defuzzify()) << + " Timer: " << power->getTimer() << + " Power1.output = " << fl::Op::str(power1->defuzzify()) << " Timer: " << power1->getTimer()); } #endif - std::cout << engine->toString() << std::endl; + fl::fuzzylite::logger->debug() << engine->toString(); Exporter* exporter; exporter = new JavaExporter; - std::cout << exporter->toString(engine) << std::endl; + fl::fuzzylite::logger->debug() << exporter->toString(engine); #if 0 else if (to == "fld") exporter = new FldExporter(" ", 1024); else if (to == "fcl") exporter = new FclExporter;