├── .cproject ├── .gitignore ├── .project ├── .travis.yml ├── CMakeLists.txt ├── Doxyfile ├── LICENSE.txt ├── README.md ├── TODO.txt ├── build.bat ├── build.sh ├── cpplint.py ├── examples └── Main.cpp ├── include └── LoggerCpp │ ├── Channel.h │ ├── Config.h │ ├── DateTime.h │ ├── Exception.h │ ├── Formatter.h │ ├── Log.h │ ├── Logger.h │ ├── LoggerCpp.h │ ├── Manager.h │ ├── Output.h │ ├── OutputConsole.h │ ├── OutputDebug.h │ ├── OutputFile.h │ ├── OutputSyslog.h │ ├── Utils.h │ └── shared_ptr.hpp └── src ├── Config.cpp ├── DateTime.cpp ├── Log.cpp ├── Logger.cpp ├── Manager.cpp ├── OutputConsole.cpp ├── OutputDebug.cpp ├── OutputFile.cpp └── OutputSyslog.cpp /.cproject: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 28 | 29 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 73 | 74 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Debug 2 | Release 3 | build 4 | lib 5 | doc 6 | 7 | CMakeCache.txt 8 | CMakeFiles 9 | *.cmake 10 | *.dir 11 | 12 | *.sln 13 | *.vcproj* 14 | *.vcxproj* 15 | *.ncb 16 | *.suo 17 | *.user 18 | *sdf 19 | *ipch 20 | *.make 21 | Makefile 22 | .settings 23 | 24 | *~ 25 | 26 | log*.txt 27 | core 28 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | LoggerCpp 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 10 | clean,full,incremental, 11 | 12 | 13 | 14 | 15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 16 | full,incremental, 17 | 18 | 19 | 20 | 21 | 22 | org.eclipse.cdt.core.cnature 23 | org.eclipse.cdt.core.ccnature 24 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 25 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 26 | 27 | 28 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: cpp 2 | 3 | compiler: 4 | - gcc 5 | - clang 6 | 7 | before_install: 8 | - sudo apt-get update -qq 9 | - sudo apt-get install -qq cppcheck 10 | 11 | before_script: 12 | - mkdir build 13 | - cd build 14 | - cmake .. 15 | 16 | script: make 17 | 18 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013-2018 Sebastien Rombauts (sebastien.rombauts@gmail.com) 2 | # 3 | # Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt 4 | # or copy at http://opensource.org/licenses/MIT) 5 | 6 | cmake_minimum_required(VERSION 2.6) 7 | project(LoggerCpp) 8 | 9 | # Define useful variables to handle OS/Compiler differences 10 | if (MSVC) 11 | set(CPPLINT_ARG_OUTPUT "--output=vs7") 12 | set(CPPCHECK_ARG_TEMPLATE "--template=vs") 13 | set(DEV_NULL "NUL") 14 | set(SYSTEM_LIBRARIES "") 15 | add_definitions (/D_CRT_SECURE_NO_WARNINGS) 16 | else() 17 | set(CPPLINT_ARG_OUTPUT "--output=eclipse") 18 | set(CPPCHECK_ARG_TEMPLATE "--template=gcc") 19 | set(DEV_NULL "/dev/null") 20 | set(SYSTEM_LIBRARIES "rt") 21 | add_definitions (-std=c++0x) # -std=c++11 22 | endif() 23 | set(CPPLINT_ARG_VERBOSE "--verbose=3") 24 | set(CPPLINT_ARG_LINELENGTH "--linelength=120") 25 | 26 | # All includes are relative to the "include" directory 27 | include_directories ("${PROJECT_SOURCE_DIR}/include") 28 | 29 | # add sources of the logger library as a "LoggerCpp" library 30 | add_library (LoggerCpp 31 | include/LoggerCpp/Channel.h 32 | include/LoggerCpp/Config.h 33 | include/LoggerCpp/DateTime.h 34 | include/LoggerCpp/Exception.h 35 | include/LoggerCpp/Formatter.h 36 | include/LoggerCpp/Log.h 37 | include/LoggerCpp/Logger.h 38 | include/LoggerCpp/LoggerCpp.h 39 | include/LoggerCpp/Manager.h 40 | include/LoggerCpp/Output.h 41 | include/LoggerCpp/OutputConsole.h 42 | include/LoggerCpp/OutputDebug.h 43 | include/LoggerCpp/OutputFile.h 44 | include/LoggerCpp/OutputSyslog.h 45 | include/LoggerCpp/shared_ptr.hpp 46 | include/LoggerCpp/Utils.h 47 | src/Config.cpp 48 | src/DateTime.cpp 49 | src/Log.cpp 50 | src/Logger.cpp 51 | src/Manager.cpp 52 | src/OutputConsole.cpp 53 | src/OutputDebug.cpp 54 | src/OutputFile.cpp 55 | src/OutputSyslog.cpp 56 | ) 57 | 58 | 59 | # Optional additional targets: 60 | 61 | option(LOGGERCPP_BUILD_EXAMPLE "Build the example of LoggerCpp." ON) 62 | if (LOGGERCPP_BUILD_EXAMPLE) 63 | # add the example executable, linked with the LoggerCpp library 64 | add_executable(LoggerCpp_Example examples/Main.cpp) 65 | target_link_libraries (LoggerCpp_Example LoggerCpp ${SYSTEM_LIBRARIES}) 66 | endif () 67 | 68 | option(LOGGERCPP_RUN_CPPLINT "Run cpplint.py tool for Google C++ StyleGuide." ON) 69 | if (LOGGERCPP_RUN_CPPLINT) 70 | # List all sources/headers files for cpplint: 71 | # adding a file still require explicittly modifing the CMakeLists.txt 72 | # so that CMake know that it should rebuild the project (it is best practice) 73 | file(GLOB all_source_files 74 | "${PROJECT_SOURCE_DIR}/include/LoggerCpp/*.h" 75 | "${PROJECT_SOURCE_DIR}/src/*.cpp" 76 | ) 77 | 78 | # add a cpplint target to the "all" target 79 | add_custom_target(LoggerCpp_cpplint 80 | ALL 81 | COMMAND python cpplint.py ${CPPLINT_ARG_OUTPUT} ${CPPLINT_ARG_VERBOSE} ${all_source_files} 82 | WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} 83 | ) 84 | endif() 85 | 86 | option(LOGGERCPP_RUN_CPPCHECK "Run cppcheck C++ static analysis tool." ON) 87 | if (LOGGERCPP_RUN_CPPCHECK) 88 | # add a cppcheck target to the "all" target 89 | add_custom_target(LoggerCpp_cppcheck 90 | ALL 91 | COMMAND cppcheck -j 4 cppcheck --enable=style --quiet ${CPPCHECK_ARG_TEMPLATE} ${PROJECT_SOURCE_DIR}/src 92 | ) 93 | endif() 94 | 95 | if (NOT DEFINED ENV{TRAVIS}) 96 | option(LOGGERCPP_RUN_DOXYGEN "Run Doxygen C++ documentation tool." ON) 97 | if (LOGGERCPP_RUN_DOXYGEN) 98 | # add a Doxygen target to the "all" target 99 | add_custom_target(LoggerCpp_doxygen 100 | ALL 101 | COMMAND doxygen Doxyfile > ${DEV_NULL} 102 | WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} 103 | ) 104 | endif() 105 | else() 106 | # but no Doxygen under Travis CI: too costly and no real benefit 107 | message("no Doxygen target when TRAVIS is defined") 108 | endif() 109 | -------------------------------------------------------------------------------- /Doxyfile: -------------------------------------------------------------------------------- 1 | # Doxyfile 1.8.3.1 2 | 3 | # This file describes the settings to be used by the documentation system 4 | # doxygen (www.doxygen.org) for a project 5 | # 6 | # All text after a hash (#) is considered a comment and will be ignored 7 | # The format is: 8 | # TAG = value [value, ...] 9 | # For lists items can also be appended using: 10 | # TAG += value [value, ...] 11 | # Values that contain spaces should be placed between quotes (" ") 12 | 13 | #--------------------------------------------------------------------------- 14 | # Project related configuration options 15 | #--------------------------------------------------------------------------- 16 | 17 | # This tag specifies the encoding used for all characters in the config file 18 | # that follow. The default is UTF-8 which is also the encoding used for all 19 | # text before the first occurrence of this tag. Doxygen uses libiconv (or the 20 | # iconv built into libc) for the transcoding. See 21 | # http://www.gnu.org/software/libiconv for the list of possible encodings. 22 | 23 | DOXYFILE_ENCODING = UTF-8 24 | 25 | # The PROJECT_NAME tag is a single word (or sequence of words) that should 26 | # identify the project. Note that if you do not use Doxywizard you need 27 | # to put quotes around the project name if it contains spaces. 28 | 29 | PROJECT_NAME = Logger 30 | 31 | # The PROJECT_NUMBER tag can be used to enter a project or revision number. 32 | # This could be handy for archiving the generated documentation or 33 | # if some version control system is used. 34 | 35 | PROJECT_NUMBER = 0.2.0 36 | 37 | # Using the PROJECT_BRIEF tag one can provide an optional one line description 38 | # for a project that appears at the top of each page and should give viewer 39 | # a quick idea about the purpose of the project. Keep the description short. 40 | 41 | PROJECT_BRIEF = "A simple, elegant and efficient C++ logger library." 42 | 43 | # With the PROJECT_LOGO tag one can specify an logo or icon that is 44 | # included in the documentation. The maximum height of the logo should not 45 | # exceed 55 pixels and the maximum width should not exceed 200 pixels. 46 | # Doxygen will copy the logo to the output directory. 47 | 48 | PROJECT_LOGO = 49 | 50 | # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 51 | # base path where the generated documentation will be put. 52 | # If a relative path is entered, it will be relative to the location 53 | # where doxygen was started. If left blank the current directory will be used. 54 | 55 | OUTPUT_DIRECTORY = doc 56 | 57 | # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 58 | # 4096 sub-directories (in 2 levels) under the output directory of each output 59 | # format and will distribute the generated files over these directories. 60 | # Enabling this option can be useful when feeding doxygen a huge amount of 61 | # source files, where putting all generated files in the same directory would 62 | # otherwise cause performance problems for the file system. 63 | 64 | CREATE_SUBDIRS = NO 65 | 66 | # The OUTPUT_LANGUAGE tag is used to specify the language in which all 67 | # documentation generated by doxygen is written. Doxygen will use this 68 | # information to generate all constant output in the proper language. 69 | # The default language is English, other supported languages are: 70 | # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, 71 | # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, 72 | # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English 73 | # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, 74 | # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, 75 | # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. 76 | 77 | OUTPUT_LANGUAGE = English 78 | 79 | # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 80 | # include brief member descriptions after the members that are listed in 81 | # the file and class documentation (similar to JavaDoc). 82 | # Set to NO to disable this. 83 | 84 | BRIEF_MEMBER_DESC = YES 85 | 86 | # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 87 | # the brief description of a member or function before the detailed description. 88 | # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 89 | # brief descriptions will be completely suppressed. 90 | 91 | REPEAT_BRIEF = YES 92 | 93 | # This tag implements a quasi-intelligent brief description abbreviator 94 | # that is used to form the text in various listings. Each string 95 | # in this list, if found as the leading text of the brief description, will be 96 | # stripped from the text and the result after processing the whole list, is 97 | # used as the annotated text. Otherwise, the brief description is used as-is. 98 | # If left blank, the following values are used ("$name" is automatically 99 | # replaced with the name of the entity): "The $name class" "The $name widget" 100 | # "The $name file" "is" "provides" "specifies" "contains" 101 | # "represents" "a" "an" "the" 102 | 103 | ABBREVIATE_BRIEF = "The $name class" \ 104 | "The $name widget" \ 105 | "The $name file" \ 106 | is \ 107 | provides \ 108 | specifies \ 109 | contains \ 110 | represents \ 111 | a \ 112 | an \ 113 | the 114 | 115 | # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 116 | # Doxygen will generate a detailed section even if there is only a brief 117 | # description. 118 | 119 | ALWAYS_DETAILED_SEC = NO 120 | 121 | # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all 122 | # inherited members of a class in the documentation of that class as if those 123 | # members were ordinary class members. Constructors, destructors and assignment 124 | # operators of the base classes will not be shown. 125 | 126 | INLINE_INHERITED_MEMB = NO 127 | 128 | # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 129 | # path before files name in the file list and in the header files. If set 130 | # to NO the shortest path that makes the file name unique will be used. 131 | 132 | FULL_PATH_NAMES = YES 133 | 134 | # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 135 | # can be used to strip a user-defined part of the path. Stripping is 136 | # only done if one of the specified strings matches the left-hand part of 137 | # the path. The tag can be used to show relative paths in the file list. 138 | # If left blank the directory from which doxygen is run is used as the 139 | # path to strip. Note that you specify absolute paths here, but also 140 | # relative paths, which will be relative from the directory where doxygen is 141 | # started. 142 | 143 | STRIP_FROM_PATH = 144 | 145 | # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of 146 | # the path mentioned in the documentation of a class, which tells 147 | # the reader which header file to include in order to use a class. 148 | # If left blank only the name of the header file containing the class 149 | # definition is used. Otherwise one should specify the include paths that 150 | # are normally passed to the compiler using the -I flag. 151 | 152 | STRIP_FROM_INC_PATH = 153 | 154 | # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter 155 | # (but less readable) file names. This can be useful if your file system 156 | # doesn't support long names like on DOS, Mac, or CD-ROM. 157 | 158 | SHORT_NAMES = NO 159 | 160 | # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 161 | # will interpret the first line (until the first dot) of a JavaDoc-style 162 | # comment as the brief description. If set to NO, the JavaDoc 163 | # comments will behave just like regular Qt-style comments 164 | # (thus requiring an explicit @brief command for a brief description.) 165 | 166 | JAVADOC_AUTOBRIEF = NO 167 | 168 | # If the QT_AUTOBRIEF tag is set to YES then Doxygen will 169 | # interpret the first line (until the first dot) of a Qt-style 170 | # comment as the brief description. If set to NO, the comments 171 | # will behave just like regular Qt-style comments (thus requiring 172 | # an explicit \brief command for a brief description.) 173 | 174 | QT_AUTOBRIEF = NO 175 | 176 | # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen 177 | # treat a multi-line C++ special comment block (i.e. a block of //! or /// 178 | # comments) as a brief description. This used to be the default behaviour. 179 | # The new default is to treat a multi-line C++ comment block as a detailed 180 | # description. Set this tag to YES if you prefer the old behaviour instead. 181 | 182 | MULTILINE_CPP_IS_BRIEF = NO 183 | 184 | # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 185 | # member inherits the documentation from any documented member that it 186 | # re-implements. 187 | 188 | INHERIT_DOCS = YES 189 | 190 | # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce 191 | # a new page for each member. If set to NO, the documentation of a member will 192 | # be part of the file/class/namespace that contains it. 193 | 194 | SEPARATE_MEMBER_PAGES = NO 195 | 196 | # The TAB_SIZE tag can be used to set the number of spaces in a tab. 197 | # Doxygen uses this value to replace tabs by spaces in code fragments. 198 | 199 | TAB_SIZE = 7 200 | 201 | # This tag can be used to specify a number of aliases that acts 202 | # as commands in the documentation. An alias has the form "name=value". 203 | # For example adding "sideeffect=\par Side Effects:\n" will allow you to 204 | # put the command \sideeffect (or @sideeffect) in the documentation, which 205 | # will result in a user-defined paragraph with heading "Side Effects:". 206 | # You can put \n's in the value part of an alias to insert newlines. 207 | 208 | ALIASES = 209 | 210 | # This tag can be used to specify a number of word-keyword mappings (TCL only). 211 | # A mapping has the form "name=value". For example adding 212 | # "class=itcl::class" will allow you to use the command class in the 213 | # itcl::class meaning. 214 | 215 | TCL_SUBST = 216 | 217 | # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C 218 | # sources only. Doxygen will then generate output that is more tailored for C. 219 | # For instance, some of the names that are used will be different. The list 220 | # of all members will be omitted, etc. 221 | 222 | OPTIMIZE_OUTPUT_FOR_C = NO 223 | 224 | # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java 225 | # sources only. Doxygen will then generate output that is more tailored for 226 | # Java. For instance, namespaces will be presented as packages, qualified 227 | # scopes will look different, etc. 228 | 229 | OPTIMIZE_OUTPUT_JAVA = NO 230 | 231 | # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran 232 | # sources only. Doxygen will then generate output that is more tailored for 233 | # Fortran. 234 | 235 | OPTIMIZE_FOR_FORTRAN = NO 236 | 237 | # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL 238 | # sources. Doxygen will then generate output that is tailored for 239 | # VHDL. 240 | 241 | OPTIMIZE_OUTPUT_VHDL = NO 242 | 243 | # Doxygen selects the parser to use depending on the extension of the files it 244 | # parses. With this tag you can assign which parser to use for a given 245 | # extension. Doxygen has a built-in mapping, but you can override or extend it 246 | # using this tag. The format is ext=language, where ext is a file extension, 247 | # and language is one of the parsers supported by doxygen: IDL, Java, 248 | # Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, 249 | # C++. For instance to make doxygen treat .inc files as Fortran files (default 250 | # is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note 251 | # that for custom extensions you also need to set FILE_PATTERNS otherwise the 252 | # files are not read by doxygen. 253 | 254 | EXTENSION_MAPPING = 255 | 256 | # If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all 257 | # comments according to the Markdown format, which allows for more readable 258 | # documentation. See http://daringfireball.net/projects/markdown/ for details. 259 | # The output of markdown processing is further processed by doxygen, so you 260 | # can mix doxygen, HTML, and XML commands with Markdown formatting. 261 | # Disable only in case of backward compatibilities issues. 262 | 263 | MARKDOWN_SUPPORT = YES 264 | 265 | # When enabled doxygen tries to link words that correspond to documented classes, 266 | # or namespaces to their corresponding documentation. Such a link can be 267 | # prevented in individual cases by by putting a % sign in front of the word or 268 | # globally by setting AUTOLINK_SUPPORT to NO. 269 | 270 | AUTOLINK_SUPPORT = YES 271 | 272 | # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want 273 | # to include (a tag file for) the STL sources as input, then you should 274 | # set this tag to YES in order to let doxygen match functions declarations and 275 | # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. 276 | # func(std::string) {}). This also makes the inheritance and collaboration 277 | # diagrams that involve STL classes more complete and accurate. 278 | 279 | BUILTIN_STL_SUPPORT = NO 280 | 281 | # If you use Microsoft's C++/CLI language, you should set this option to YES to 282 | # enable parsing support. 283 | 284 | CPP_CLI_SUPPORT = NO 285 | 286 | # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. 287 | # Doxygen will parse them like normal C++ but will assume all classes use public 288 | # instead of private inheritance when no explicit protection keyword is present. 289 | 290 | SIP_SUPPORT = NO 291 | 292 | # For Microsoft's IDL there are propget and propput attributes to indicate 293 | # getter and setter methods for a property. Setting this option to YES (the 294 | # default) will make doxygen replace the get and set methods by a property in 295 | # the documentation. This will only work if the methods are indeed getting or 296 | # setting a simple type. If this is not the case, or you want to show the 297 | # methods anyway, you should set this option to NO. 298 | 299 | IDL_PROPERTY_SUPPORT = YES 300 | 301 | # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 302 | # tag is set to YES, then doxygen will reuse the documentation of the first 303 | # member in the group (if any) for the other members of the group. By default 304 | # all members of a group must be documented explicitly. 305 | 306 | DISTRIBUTE_GROUP_DOC = NO 307 | 308 | # Set the SUBGROUPING tag to YES (the default) to allow class member groups of 309 | # the same type (for instance a group of public functions) to be put as a 310 | # subgroup of that type (e.g. under the Public Functions section). Set it to 311 | # NO to prevent subgrouping. Alternatively, this can be done per class using 312 | # the \nosubgrouping command. 313 | 314 | SUBGROUPING = YES 315 | 316 | # When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and 317 | # unions are shown inside the group in which they are included (e.g. using 318 | # @ingroup) instead of on a separate page (for HTML and Man pages) or 319 | # section (for LaTeX and RTF). 320 | 321 | INLINE_GROUPED_CLASSES = NO 322 | 323 | # When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and 324 | # unions with only public data fields will be shown inline in the documentation 325 | # of the scope in which they are defined (i.e. file, namespace, or group 326 | # documentation), provided this scope is documented. If set to NO (the default), 327 | # structs, classes, and unions are shown on a separate page (for HTML and Man 328 | # pages) or section (for LaTeX and RTF). 329 | 330 | INLINE_SIMPLE_STRUCTS = NO 331 | 332 | # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum 333 | # is documented as struct, union, or enum with the name of the typedef. So 334 | # typedef struct TypeS {} TypeT, will appear in the documentation as a struct 335 | # with name TypeT. When disabled the typedef will appear as a member of a file, 336 | # namespace, or class. And the struct will be named TypeS. This can typically 337 | # be useful for C code in case the coding convention dictates that all compound 338 | # types are typedef'ed and only the typedef is referenced, never the tag name. 339 | 340 | TYPEDEF_HIDES_STRUCT = NO 341 | 342 | # Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be 343 | # set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given 344 | # their name and scope. Since this can be an expensive process and often the 345 | # same symbol appear multiple times in the code, doxygen keeps a cache of 346 | # pre-resolved symbols. If the cache is too small doxygen will become slower. 347 | # If the cache is too large, memory is wasted. The cache size is given by this 348 | # formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, 349 | # corresponding to a cache size of 2^16 = 65536 symbols. 350 | 351 | LOOKUP_CACHE_SIZE = 0 352 | 353 | #--------------------------------------------------------------------------- 354 | # Build related configuration options 355 | #--------------------------------------------------------------------------- 356 | 357 | # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 358 | # documentation are documented, even if no documentation was available. 359 | # Private class members and static file members will be hidden unless 360 | # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES 361 | 362 | EXTRACT_ALL = NO 363 | 364 | # If the EXTRACT_PRIVATE tag is set to YES all private members of a class 365 | # will be included in the documentation. 366 | 367 | EXTRACT_PRIVATE = YES 368 | 369 | # If the EXTRACT_PACKAGE tag is set to YES all members with package or internal 370 | # scope will be included in the documentation. 371 | 372 | EXTRACT_PACKAGE = NO 373 | 374 | # If the EXTRACT_STATIC tag is set to YES all static members of a file 375 | # will be included in the documentation. 376 | 377 | EXTRACT_STATIC = YES 378 | 379 | # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) 380 | # defined locally in source files will be included in the documentation. 381 | # If set to NO only classes defined in header files are included. 382 | 383 | EXTRACT_LOCAL_CLASSES = YES 384 | 385 | # This flag is only useful for Objective-C code. When set to YES local 386 | # methods, which are defined in the implementation section but not in 387 | # the interface are included in the documentation. 388 | # If set to NO (the default) only methods in the interface are included. 389 | 390 | EXTRACT_LOCAL_METHODS = NO 391 | 392 | # If this flag is set to YES, the members of anonymous namespaces will be 393 | # extracted and appear in the documentation as a namespace called 394 | # 'anonymous_namespace{file}', where file will be replaced with the base 395 | # name of the file that contains the anonymous namespace. By default 396 | # anonymous namespaces are hidden. 397 | 398 | EXTRACT_ANON_NSPACES = NO 399 | 400 | # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 401 | # undocumented members of documented classes, files or namespaces. 402 | # If set to NO (the default) these members will be included in the 403 | # various overviews, but no documentation section is generated. 404 | # This option has no effect if EXTRACT_ALL is enabled. 405 | 406 | HIDE_UNDOC_MEMBERS = NO 407 | 408 | # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 409 | # undocumented classes that are normally visible in the class hierarchy. 410 | # If set to NO (the default) these classes will be included in the various 411 | # overviews. This option has no effect if EXTRACT_ALL is enabled. 412 | 413 | HIDE_UNDOC_CLASSES = NO 414 | 415 | # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all 416 | # friend (class|struct|union) declarations. 417 | # If set to NO (the default) these declarations will be included in the 418 | # documentation. 419 | 420 | HIDE_FRIEND_COMPOUNDS = NO 421 | 422 | # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any 423 | # documentation blocks found inside the body of a function. 424 | # If set to NO (the default) these blocks will be appended to the 425 | # function's detailed documentation block. 426 | 427 | HIDE_IN_BODY_DOCS = NO 428 | 429 | # The INTERNAL_DOCS tag determines if documentation 430 | # that is typed after a \internal command is included. If the tag is set 431 | # to NO (the default) then the documentation will be excluded. 432 | # Set it to YES to include the internal documentation. 433 | 434 | INTERNAL_DOCS = NO 435 | 436 | # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 437 | # file names in lower-case letters. If set to YES upper-case letters are also 438 | # allowed. This is useful if you have classes or files whose names only differ 439 | # in case and if your file system supports case sensitive file names. Windows 440 | # and Mac users are advised to set this option to NO. 441 | 442 | CASE_SENSE_NAMES = NO 443 | 444 | # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 445 | # will show members with their full class and namespace scopes in the 446 | # documentation. If set to YES the scope will be hidden. 447 | 448 | HIDE_SCOPE_NAMES = NO 449 | 450 | # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 451 | # will put a list of the files that are included by a file in the documentation 452 | # of that file. 453 | 454 | SHOW_INCLUDE_FILES = YES 455 | 456 | # If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen 457 | # will list include files with double quotes in the documentation 458 | # rather than with sharp brackets. 459 | 460 | FORCE_LOCAL_INCLUDES = NO 461 | 462 | # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 463 | # is inserted in the documentation for inline members. 464 | 465 | INLINE_INFO = YES 466 | 467 | # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 468 | # will sort the (detailed) documentation of file and class members 469 | # alphabetically by member name. If set to NO the members will appear in 470 | # declaration order. 471 | 472 | SORT_MEMBER_DOCS = YES 473 | 474 | # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the 475 | # brief documentation of file, namespace and class members alphabetically 476 | # by member name. If set to NO (the default) the members will appear in 477 | # declaration order. 478 | 479 | SORT_BRIEF_DOCS = NO 480 | 481 | # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen 482 | # will sort the (brief and detailed) documentation of class members so that 483 | # constructors and destructors are listed first. If set to NO (the default) 484 | # the constructors will appear in the respective orders defined by 485 | # SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. 486 | # This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO 487 | # and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. 488 | 489 | SORT_MEMBERS_CTORS_1ST = NO 490 | 491 | # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the 492 | # hierarchy of group names into alphabetical order. If set to NO (the default) 493 | # the group names will appear in their defined order. 494 | 495 | SORT_GROUP_NAMES = NO 496 | 497 | # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be 498 | # sorted by fully-qualified names, including namespaces. If set to 499 | # NO (the default), the class list will be sorted only by class name, 500 | # not including the namespace part. 501 | # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. 502 | # Note: This option applies only to the class list, not to the 503 | # alphabetical list. 504 | 505 | SORT_BY_SCOPE_NAME = NO 506 | 507 | # If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to 508 | # do proper type resolution of all parameters of a function it will reject a 509 | # match between the prototype and the implementation of a member function even 510 | # if there is only one candidate or it is obvious which candidate to choose 511 | # by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen 512 | # will still accept a match between prototype and implementation in such cases. 513 | 514 | STRICT_PROTO_MATCHING = NO 515 | 516 | # The GENERATE_TODOLIST tag can be used to enable (YES) or 517 | # disable (NO) the todo list. This list is created by putting \todo 518 | # commands in the documentation. 519 | 520 | GENERATE_TODOLIST = YES 521 | 522 | # The GENERATE_TESTLIST tag can be used to enable (YES) or 523 | # disable (NO) the test list. This list is created by putting \test 524 | # commands in the documentation. 525 | 526 | GENERATE_TESTLIST = YES 527 | 528 | # The GENERATE_BUGLIST tag can be used to enable (YES) or 529 | # disable (NO) the bug list. This list is created by putting \bug 530 | # commands in the documentation. 531 | 532 | GENERATE_BUGLIST = YES 533 | 534 | # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or 535 | # disable (NO) the deprecated list. This list is created by putting 536 | # \deprecated commands in the documentation. 537 | 538 | GENERATE_DEPRECATEDLIST= YES 539 | 540 | # The ENABLED_SECTIONS tag can be used to enable conditional 541 | # documentation sections, marked by \if section-label ... \endif 542 | # and \cond section-label ... \endcond blocks. 543 | 544 | ENABLED_SECTIONS = 545 | 546 | # The MAX_INITIALIZER_LINES tag determines the maximum number of lines 547 | # the initial value of a variable or macro consists of for it to appear in 548 | # the documentation. If the initializer consists of more lines than specified 549 | # here it will be hidden. Use a value of 0 to hide initializers completely. 550 | # The appearance of the initializer of individual variables and macros in the 551 | # documentation can be controlled using \showinitializer or \hideinitializer 552 | # command in the documentation regardless of this setting. 553 | 554 | MAX_INITIALIZER_LINES = 30 555 | 556 | # Set the SHOW_USED_FILES tag to NO to disable the list of files generated 557 | # at the bottom of the documentation of classes and structs. If set to YES the 558 | # list will mention the files that were used to generate the documentation. 559 | 560 | SHOW_USED_FILES = YES 561 | 562 | # Set the SHOW_FILES tag to NO to disable the generation of the Files page. 563 | # This will remove the Files entry from the Quick Index and from the 564 | # Folder Tree View (if specified). The default is YES. 565 | 566 | SHOW_FILES = YES 567 | 568 | # Set the SHOW_NAMESPACES tag to NO to disable the generation of the 569 | # Namespaces page. This will remove the Namespaces entry from the Quick Index 570 | # and from the Folder Tree View (if specified). The default is YES. 571 | 572 | SHOW_NAMESPACES = NO 573 | 574 | # The FILE_VERSION_FILTER tag can be used to specify a program or script that 575 | # doxygen should invoke to get the current version for each file (typically from 576 | # the version control system). Doxygen will invoke the program by executing (via 577 | # popen()) the command , where is the value of 578 | # the FILE_VERSION_FILTER tag, and is the name of an input file 579 | # provided by doxygen. Whatever the program writes to standard output 580 | # is used as the file version. See the manual for examples. 581 | 582 | FILE_VERSION_FILTER = 583 | 584 | # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed 585 | # by doxygen. The layout file controls the global structure of the generated 586 | # output files in an output format independent way. To create the layout file 587 | # that represents doxygen's defaults, run doxygen with the -l option. 588 | # You can optionally specify a file name after the option, if omitted 589 | # DoxygenLayout.xml will be used as the name of the layout file. 590 | 591 | LAYOUT_FILE = 592 | 593 | # The CITE_BIB_FILES tag can be used to specify one or more bib files 594 | # containing the references data. This must be a list of .bib files. The 595 | # .bib extension is automatically appended if omitted. Using this command 596 | # requires the bibtex tool to be installed. See also 597 | # http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style 598 | # of the bibliography can be controlled using LATEX_BIB_STYLE. To use this 599 | # feature you need bibtex and perl available in the search path. Do not use 600 | # file names with spaces, bibtex cannot handle them. 601 | 602 | CITE_BIB_FILES = 603 | 604 | #--------------------------------------------------------------------------- 605 | # configuration options related to warning and progress messages 606 | #--------------------------------------------------------------------------- 607 | 608 | # The QUIET tag can be used to turn on/off the messages that are generated 609 | # by doxygen. Possible values are YES and NO. If left blank NO is used. 610 | 611 | QUIET = NO 612 | 613 | # The WARNINGS tag can be used to turn on/off the warning messages that are 614 | # generated by doxygen. Possible values are YES and NO. If left blank 615 | # NO is used. 616 | 617 | WARNINGS = YES 618 | 619 | # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 620 | # for undocumented members. If EXTRACT_ALL is set to YES then this flag will 621 | # automatically be disabled. 622 | 623 | WARN_IF_UNDOCUMENTED = YES 624 | 625 | # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for 626 | # potential errors in the documentation, such as not documenting some 627 | # parameters in a documented function, or documenting parameters that 628 | # don't exist or using markup commands wrongly. 629 | 630 | WARN_IF_DOC_ERROR = YES 631 | 632 | # The WARN_NO_PARAMDOC option can be enabled to get warnings for 633 | # functions that are documented, but have no documentation for their parameters 634 | # or return value. If set to NO (the default) doxygen will only warn about 635 | # wrong or incomplete parameter documentation, but not about the absence of 636 | # documentation. 637 | 638 | WARN_NO_PARAMDOC = YES 639 | 640 | # The WARN_FORMAT tag determines the format of the warning messages that 641 | # doxygen can produce. The string should contain the $file, $line, and $text 642 | # tags, which will be replaced by the file and line number from which the 643 | # warning originated and the warning text. Optionally the format may contain 644 | # $version, which will be replaced by the version of the file (if it could 645 | # be obtained via FILE_VERSION_FILTER) 646 | 647 | # GCC format: 648 | WARN_FORMAT = "$file:$line: $text" 649 | # MSVC format: 650 | #WARN_FORMAT = "$file($line): $text" 651 | 652 | # The WARN_LOGFILE tag can be used to specify a file to which warning 653 | # and error messages should be written. If left blank the output is written 654 | # to stderr. 655 | 656 | WARN_LOGFILE = 657 | 658 | #--------------------------------------------------------------------------- 659 | # configuration options related to the input files 660 | #--------------------------------------------------------------------------- 661 | 662 | # The INPUT tag can be used to specify the files and/or directories that contain 663 | # documented source files. You may enter file names like "myfile.cpp" or 664 | # directories like "/usr/src/myproject". Separate the files or directories 665 | # with spaces. 666 | 667 | INPUT = src include 668 | 669 | # This tag can be used to specify the character encoding of the source files 670 | # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is 671 | # also the default input encoding. Doxygen uses libiconv (or the iconv built 672 | # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for 673 | # the list of possible encodings. 674 | 675 | INPUT_ENCODING = UTF-8 676 | 677 | # If the value of the INPUT tag contains directories, you can use the 678 | # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 679 | # and *.h) to filter out the source-files in the directories. If left 680 | # blank the following patterns are tested: 681 | # *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh 682 | # *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py 683 | # *.f90 *.f *.for *.vhd *.vhdl 684 | 685 | FILE_PATTERNS = *.cpp \ 686 | *.h \ 687 | *.hpp 688 | 689 | # The RECURSIVE tag can be used to turn specify whether or not subdirectories 690 | # should be searched for input files as well. Possible values are YES and NO. 691 | # If left blank NO is used. 692 | 693 | RECURSIVE = YES 694 | 695 | # The EXCLUDE tag can be used to specify files and/or directories that should be 696 | # excluded from the INPUT source files. This way you can easily exclude a 697 | # subdirectory from a directory tree whose root is specified with the INPUT tag. 698 | # Note that relative paths are relative to the directory from which doxygen is 699 | # run. 700 | 701 | EXCLUDE = include/LoggerCpp/shared_ptr.hpp 702 | 703 | # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or 704 | # directories that are symbolic links (a Unix file system feature) are excluded 705 | # from the input. 706 | 707 | EXCLUDE_SYMLINKS = NO 708 | 709 | # If the value of the INPUT tag contains directories, you can use the 710 | # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 711 | # certain files from those directories. Note that the wildcards are matched 712 | # against the file with absolute path, so to exclude all test directories 713 | # for example use the pattern */test/* 714 | 715 | EXCLUDE_PATTERNS = 716 | 717 | # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names 718 | # (namespaces, classes, functions, etc.) that should be excluded from the 719 | # output. The symbol name can be a fully qualified name, a word, or if the 720 | # wildcard * is used, a substring. Examples: ANamespace, AClass, 721 | # AClass::ANamespace, ANamespace::*Test 722 | 723 | EXCLUDE_SYMBOLS = 724 | 725 | # The EXAMPLE_PATH tag can be used to specify one or more files or 726 | # directories that contain example code fragments that are included (see 727 | # the \include command). 728 | 729 | EXAMPLE_PATH = 730 | 731 | # If the value of the EXAMPLE_PATH tag contains directories, you can use the 732 | # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 733 | # and *.h) to filter out the source-files in the directories. If left 734 | # blank all files are included. 735 | 736 | EXAMPLE_PATTERNS = * 737 | 738 | # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be 739 | # searched for input files to be used with the \include or \dontinclude 740 | # commands irrespective of the value of the RECURSIVE tag. 741 | # Possible values are YES and NO. If left blank NO is used. 742 | 743 | EXAMPLE_RECURSIVE = NO 744 | 745 | # The IMAGE_PATH tag can be used to specify one or more files or 746 | # directories that contain image that are included in the documentation (see 747 | # the \image command). 748 | 749 | IMAGE_PATH = 750 | 751 | # The INPUT_FILTER tag can be used to specify a program that doxygen should 752 | # invoke to filter for each input file. Doxygen will invoke the filter program 753 | # by executing (via popen()) the command , where 754 | # is the value of the INPUT_FILTER tag, and is the name of an 755 | # input file. Doxygen will then use the output that the filter program writes 756 | # to standard output. If FILTER_PATTERNS is specified, this tag will be 757 | # ignored. 758 | 759 | INPUT_FILTER = 760 | 761 | # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern 762 | # basis. Doxygen will compare the file name with each pattern and apply the 763 | # filter if there is a match. The filters are a list of the form: 764 | # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further 765 | # info on how filters are used. If FILTER_PATTERNS is empty or if 766 | # non of the patterns match the file name, INPUT_FILTER is applied. 767 | 768 | FILTER_PATTERNS = 769 | 770 | # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 771 | # INPUT_FILTER) will be used to filter the input files when producing source 772 | # files to browse (i.e. when SOURCE_BROWSER is set to YES). 773 | 774 | FILTER_SOURCE_FILES = NO 775 | 776 | # The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file 777 | # pattern. A pattern will override the setting for FILTER_PATTERN (if any) 778 | # and it is also possible to disable source filtering for a specific pattern 779 | # using *.ext= (so without naming a filter). This option only has effect when 780 | # FILTER_SOURCE_FILES is enabled. 781 | 782 | FILTER_SOURCE_PATTERNS = 783 | 784 | # If the USE_MD_FILE_AS_MAINPAGE tag refers to the name of a markdown file that 785 | # is part of the input, its contents will be placed on the main page (index.html). 786 | # This can be useful if you have a project on for instance GitHub and want reuse 787 | # the introduction page also for the doxygen output. 788 | 789 | USE_MDFILE_AS_MAINPAGE = 790 | 791 | #--------------------------------------------------------------------------- 792 | # configuration options related to source browsing 793 | #--------------------------------------------------------------------------- 794 | 795 | # If the SOURCE_BROWSER tag is set to YES then a list of source files will 796 | # be generated. Documented entities will be cross-referenced with these sources. 797 | # Note: To get rid of all source code in the generated output, make sure also 798 | # VERBATIM_HEADERS is set to NO. 799 | 800 | SOURCE_BROWSER = YES 801 | 802 | # Setting the INLINE_SOURCES tag to YES will include the body 803 | # of functions and classes directly in the documentation. 804 | 805 | INLINE_SOURCES = NO 806 | 807 | # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 808 | # doxygen to hide any special comment blocks from generated source code 809 | # fragments. Normal C, C++ and Fortran comments will always remain visible. 810 | 811 | STRIP_CODE_COMMENTS = NO 812 | 813 | # If the REFERENCED_BY_RELATION tag is set to YES 814 | # then for each documented function all documented 815 | # functions referencing it will be listed. 816 | 817 | REFERENCED_BY_RELATION = NO 818 | 819 | # If the REFERENCES_RELATION tag is set to YES 820 | # then for each documented function all documented entities 821 | # called/used by that function will be listed. 822 | 823 | REFERENCES_RELATION = NO 824 | 825 | # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) 826 | # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from 827 | # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will 828 | # link to the source code. Otherwise they will link to the documentation. 829 | 830 | REFERENCES_LINK_SOURCE = YES 831 | 832 | # If the USE_HTAGS tag is set to YES then the references to source code 833 | # will point to the HTML generated by the htags(1) tool instead of doxygen 834 | # built-in source browser. The htags tool is part of GNU's global source 835 | # tagging system (see http://www.gnu.org/software/global/global.html). You 836 | # will need version 4.8.6 or higher. 837 | 838 | USE_HTAGS = NO 839 | 840 | # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 841 | # will generate a verbatim copy of the header file for each class for 842 | # which an include is specified. Set to NO to disable this. 843 | 844 | VERBATIM_HEADERS = YES 845 | 846 | #--------------------------------------------------------------------------- 847 | # configuration options related to the alphabetical class index 848 | #--------------------------------------------------------------------------- 849 | 850 | # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 851 | # of all compounds will be generated. Enable this if the project 852 | # contains a lot of classes, structs, unions or interfaces. 853 | 854 | ALPHABETICAL_INDEX = YES 855 | 856 | # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 857 | # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 858 | # in which this list will be split (can be a number in the range [1..20]) 859 | 860 | COLS_IN_ALPHA_INDEX = 5 861 | 862 | # In case all classes in a project start with a common prefix, all 863 | # classes will be put under the same header in the alphabetical index. 864 | # The IGNORE_PREFIX tag can be used to specify one or more prefixes that 865 | # should be ignored while generating the index headers. 866 | 867 | IGNORE_PREFIX = 868 | 869 | #--------------------------------------------------------------------------- 870 | # configuration options related to the HTML output 871 | #--------------------------------------------------------------------------- 872 | 873 | # If the GENERATE_HTML tag is set to YES (the default) Doxygen will 874 | # generate HTML output. 875 | 876 | GENERATE_HTML = YES 877 | 878 | # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 879 | # If a relative path is entered the value of OUTPUT_DIRECTORY will be 880 | # put in front of it. If left blank `html' will be used as the default path. 881 | 882 | HTML_OUTPUT = html 883 | 884 | # The HTML_FILE_EXTENSION tag can be used to specify the file extension for 885 | # each generated HTML page (for example: .htm,.php,.asp). If it is left blank 886 | # doxygen will generate files with .html extension. 887 | 888 | HTML_FILE_EXTENSION = .html 889 | 890 | # The HTML_HEADER tag can be used to specify a personal HTML header for 891 | # each generated HTML page. If it is left blank doxygen will generate a 892 | # standard header. Note that when using a custom header you are responsible 893 | # for the proper inclusion of any scripts and style sheets that doxygen 894 | # needs, which is dependent on the configuration options used. 895 | # It is advised to generate a default header using "doxygen -w html 896 | # header.html footer.html stylesheet.css YourConfigFile" and then modify 897 | # that header. Note that the header is subject to change so you typically 898 | # have to redo this when upgrading to a newer version of doxygen or when 899 | # changing the value of configuration settings such as GENERATE_TREEVIEW! 900 | 901 | HTML_HEADER = 902 | 903 | # The HTML_FOOTER tag can be used to specify a personal HTML footer for 904 | # each generated HTML page. If it is left blank doxygen will generate a 905 | # standard footer. 906 | 907 | HTML_FOOTER = 908 | 909 | # The HTML_STYLESHEET tag can be used to specify a user-defined cascading 910 | # style sheet that is used by each HTML page. It can be used to 911 | # fine-tune the look of the HTML output. If left blank doxygen will 912 | # generate a default style sheet. Note that it is recommended to use 913 | # HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this 914 | # tag will in the future become obsolete. 915 | 916 | HTML_STYLESHEET = 917 | 918 | # The HTML_EXTRA_STYLESHEET tag can be used to specify an additional 919 | # user-defined cascading style sheet that is included after the standard 920 | # style sheets created by doxygen. Using this option one can overrule 921 | # certain style aspects. This is preferred over using HTML_STYLESHEET 922 | # since it does not replace the standard style sheet and is therefor more 923 | # robust against future updates. Doxygen will copy the style sheet file to 924 | # the output directory. 925 | 926 | HTML_EXTRA_STYLESHEET = 927 | 928 | # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or 929 | # other source files which should be copied to the HTML output directory. Note 930 | # that these files will be copied to the base HTML output directory. Use the 931 | # $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these 932 | # files. In the HTML_STYLESHEET file, use the file name only. Also note that 933 | # the files will be copied as-is; there are no commands or markers available. 934 | 935 | HTML_EXTRA_FILES = 936 | 937 | # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. 938 | # Doxygen will adjust the colors in the style sheet and background images 939 | # according to this color. Hue is specified as an angle on a colorwheel, 940 | # see http://en.wikipedia.org/wiki/Hue for more information. 941 | # For instance the value 0 represents red, 60 is yellow, 120 is green, 942 | # 180 is cyan, 240 is blue, 300 purple, and 360 is red again. 943 | # The allowed range is 0 to 359. 944 | 945 | HTML_COLORSTYLE_HUE = 220 946 | 947 | # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of 948 | # the colors in the HTML output. For a value of 0 the output will use 949 | # grayscales only. A value of 255 will produce the most vivid colors. 950 | 951 | HTML_COLORSTYLE_SAT = 100 952 | 953 | # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to 954 | # the luminance component of the colors in the HTML output. Values below 955 | # 100 gradually make the output lighter, whereas values above 100 make 956 | # the output darker. The value divided by 100 is the actual gamma applied, 957 | # so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, 958 | # and 100 does not change the gamma. 959 | 960 | HTML_COLORSTYLE_GAMMA = 80 961 | 962 | # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML 963 | # page will contain the date and time when the page was generated. Setting 964 | # this to NO can help when comparing the output of multiple runs. 965 | 966 | HTML_TIMESTAMP = YES 967 | 968 | # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML 969 | # documentation will contain sections that can be hidden and shown after the 970 | # page has loaded. 971 | 972 | HTML_DYNAMIC_SECTIONS = NO 973 | 974 | # With HTML_INDEX_NUM_ENTRIES one can control the preferred number of 975 | # entries shown in the various tree structured indices initially; the user 976 | # can expand and collapse entries dynamically later on. Doxygen will expand 977 | # the tree to such a level that at most the specified number of entries are 978 | # visible (unless a fully collapsed tree already exceeds this amount). 979 | # So setting the number of entries 1 will produce a full collapsed tree by 980 | # default. 0 is a special value representing an infinite number of entries 981 | # and will result in a full expanded tree by default. 982 | 983 | HTML_INDEX_NUM_ENTRIES = 100 984 | 985 | # If the GENERATE_DOCSET tag is set to YES, additional index files 986 | # will be generated that can be used as input for Apple's Xcode 3 987 | # integrated development environment, introduced with OSX 10.5 (Leopard). 988 | # To create a documentation set, doxygen will generate a Makefile in the 989 | # HTML output directory. Running make will produce the docset in that 990 | # directory and running "make install" will install the docset in 991 | # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find 992 | # it at startup. 993 | # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html 994 | # for more information. 995 | 996 | GENERATE_DOCSET = NO 997 | 998 | # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the 999 | # feed. A documentation feed provides an umbrella under which multiple 1000 | # documentation sets from a single provider (such as a company or product suite) 1001 | # can be grouped. 1002 | 1003 | DOCSET_FEEDNAME = "Doxygen generated docs" 1004 | 1005 | # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that 1006 | # should uniquely identify the documentation set bundle. This should be a 1007 | # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen 1008 | # will append .docset to the name. 1009 | 1010 | DOCSET_BUNDLE_ID = org.doxygen.Project 1011 | 1012 | # When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely 1013 | # identify the documentation publisher. This should be a reverse domain-name 1014 | # style string, e.g. com.mycompany.MyDocSet.documentation. 1015 | 1016 | DOCSET_PUBLISHER_ID = org.doxygen.Publisher 1017 | 1018 | # The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. 1019 | 1020 | DOCSET_PUBLISHER_NAME = Publisher 1021 | 1022 | # If the GENERATE_HTMLHELP tag is set to YES, additional index files 1023 | # will be generated that can be used as input for tools like the 1024 | # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) 1025 | # of the generated HTML documentation. 1026 | 1027 | GENERATE_HTMLHELP = NO 1028 | 1029 | # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can 1030 | # be used to specify the file name of the resulting .chm file. You 1031 | # can add a path in front of the file if the result should not be 1032 | # written to the html output directory. 1033 | 1034 | CHM_FILE = 1035 | 1036 | # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can 1037 | # be used to specify the location (absolute path including file name) of 1038 | # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run 1039 | # the HTML help compiler on the generated index.hhp. 1040 | 1041 | HHC_LOCATION = 1042 | 1043 | # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag 1044 | # controls if a separate .chi index file is generated (YES) or that 1045 | # it should be included in the master .chm file (NO). 1046 | 1047 | GENERATE_CHI = NO 1048 | 1049 | # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING 1050 | # is used to encode HtmlHelp index (hhk), content (hhc) and project file 1051 | # content. 1052 | 1053 | CHM_INDEX_ENCODING = 1054 | 1055 | # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag 1056 | # controls whether a binary table of contents is generated (YES) or a 1057 | # normal table of contents (NO) in the .chm file. 1058 | 1059 | BINARY_TOC = NO 1060 | 1061 | # The TOC_EXPAND flag can be set to YES to add extra items for group members 1062 | # to the contents of the HTML help documentation and to the tree view. 1063 | 1064 | TOC_EXPAND = NO 1065 | 1066 | # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and 1067 | # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated 1068 | # that can be used as input for Qt's qhelpgenerator to generate a 1069 | # Qt Compressed Help (.qch) of the generated HTML documentation. 1070 | 1071 | GENERATE_QHP = NO 1072 | 1073 | # If the QHG_LOCATION tag is specified, the QCH_FILE tag can 1074 | # be used to specify the file name of the resulting .qch file. 1075 | # The path specified is relative to the HTML output folder. 1076 | 1077 | QCH_FILE = 1078 | 1079 | # The QHP_NAMESPACE tag specifies the namespace to use when generating 1080 | # Qt Help Project output. For more information please see 1081 | # http://doc.trolltech.com/qthelpproject.html#namespace 1082 | 1083 | QHP_NAMESPACE = org.doxygen.Project 1084 | 1085 | # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating 1086 | # Qt Help Project output. For more information please see 1087 | # http://doc.trolltech.com/qthelpproject.html#virtual-folders 1088 | 1089 | QHP_VIRTUAL_FOLDER = doc 1090 | 1091 | # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to 1092 | # add. For more information please see 1093 | # http://doc.trolltech.com/qthelpproject.html#custom-filters 1094 | 1095 | QHP_CUST_FILTER_NAME = 1096 | 1097 | # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the 1098 | # custom filter to add. For more information please see 1099 | # 1100 | # Qt Help Project / Custom Filters. 1101 | 1102 | QHP_CUST_FILTER_ATTRS = 1103 | 1104 | # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this 1105 | # project's 1106 | # filter section matches. 1107 | # 1108 | # Qt Help Project / Filter Attributes. 1109 | 1110 | QHP_SECT_FILTER_ATTRS = 1111 | 1112 | # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can 1113 | # be used to specify the location of Qt's qhelpgenerator. 1114 | # If non-empty doxygen will try to run qhelpgenerator on the generated 1115 | # .qhp file. 1116 | 1117 | QHG_LOCATION = 1118 | 1119 | # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files 1120 | # will be generated, which together with the HTML files, form an Eclipse help 1121 | # plugin. To install this plugin and make it available under the help contents 1122 | # menu in Eclipse, the contents of the directory containing the HTML and XML 1123 | # files needs to be copied into the plugins directory of eclipse. The name of 1124 | # the directory within the plugins directory should be the same as 1125 | # the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before 1126 | # the help appears. 1127 | 1128 | GENERATE_ECLIPSEHELP = NO 1129 | 1130 | # A unique identifier for the eclipse help plugin. When installing the plugin 1131 | # the directory name containing the HTML and XML files should also have 1132 | # this name. 1133 | 1134 | ECLIPSE_DOC_ID = org.doxygen.Project 1135 | 1136 | # The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) 1137 | # at top of each HTML page. The value NO (the default) enables the index and 1138 | # the value YES disables it. Since the tabs have the same information as the 1139 | # navigation tree you can set this option to NO if you already set 1140 | # GENERATE_TREEVIEW to YES. 1141 | 1142 | DISABLE_INDEX = NO 1143 | 1144 | # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index 1145 | # structure should be generated to display hierarchical information. 1146 | # If the tag value is set to YES, a side panel will be generated 1147 | # containing a tree-like index structure (just like the one that 1148 | # is generated for HTML Help). For this to work a browser that supports 1149 | # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). 1150 | # Windows users are probably better off using the HTML help feature. 1151 | # Since the tree basically has the same information as the tab index you 1152 | # could consider to set DISABLE_INDEX to NO when enabling this option. 1153 | 1154 | GENERATE_TREEVIEW = YES 1155 | 1156 | # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values 1157 | # (range [0,1..20]) that doxygen will group on one line in the generated HTML 1158 | # documentation. Note that a value of 0 will completely suppress the enum 1159 | # values from appearing in the overview section. 1160 | 1161 | ENUM_VALUES_PER_LINE = 4 1162 | 1163 | # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 1164 | # used to set the initial width (in pixels) of the frame in which the tree 1165 | # is shown. 1166 | 1167 | TREEVIEW_WIDTH = 250 1168 | 1169 | # When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open 1170 | # links to external symbols imported via tag files in a separate window. 1171 | 1172 | EXT_LINKS_IN_WINDOW = NO 1173 | 1174 | # Use this tag to change the font size of Latex formulas included 1175 | # as images in the HTML documentation. The default is 10. Note that 1176 | # when you change the font size after a successful doxygen run you need 1177 | # to manually remove any form_*.png images from the HTML output directory 1178 | # to force them to be regenerated. 1179 | 1180 | FORMULA_FONTSIZE = 10 1181 | 1182 | # Use the FORMULA_TRANPARENT tag to determine whether or not the images 1183 | # generated for formulas are transparent PNGs. Transparent PNGs are 1184 | # not supported properly for IE 6.0, but are supported on all modern browsers. 1185 | # Note that when changing this option you need to delete any form_*.png files 1186 | # in the HTML output before the changes have effect. 1187 | 1188 | FORMULA_TRANSPARENT = YES 1189 | 1190 | # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax 1191 | # (see http://www.mathjax.org) which uses client side Javascript for the 1192 | # rendering instead of using prerendered bitmaps. Use this if you do not 1193 | # have LaTeX installed or if you want to formulas look prettier in the HTML 1194 | # output. When enabled you may also need to install MathJax separately and 1195 | # configure the path to it using the MATHJAX_RELPATH option. 1196 | 1197 | USE_MATHJAX = NO 1198 | 1199 | # When MathJax is enabled you can set the default output format to be used for 1200 | # thA MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and 1201 | # SVG. The default value is HTML-CSS, which is slower, but has the best 1202 | # compatibility. 1203 | 1204 | MATHJAX_FORMAT = HTML-CSS 1205 | 1206 | # When MathJax is enabled you need to specify the location relative to the 1207 | # HTML output directory using the MATHJAX_RELPATH option. The destination 1208 | # directory should contain the MathJax.js script. For instance, if the mathjax 1209 | # directory is located at the same level as the HTML output directory, then 1210 | # MATHJAX_RELPATH should be ../mathjax. The default value points to 1211 | # the MathJax Content Delivery Network so you can quickly see the result without 1212 | # installing MathJax. However, it is strongly recommended to install a local 1213 | # copy of MathJax from http://www.mathjax.org before deployment. 1214 | 1215 | MATHJAX_RELPATH = http://www.mathjax.org/mathjax 1216 | 1217 | # The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension 1218 | # names that should be enabled during MathJax rendering. 1219 | 1220 | MATHJAX_EXTENSIONS = 1221 | 1222 | # When the SEARCHENGINE tag is enabled doxygen will generate a search box 1223 | # for the HTML output. The underlying search engine uses javascript 1224 | # and DHTML and should work on any modern browser. Note that when using 1225 | # HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets 1226 | # (GENERATE_DOCSET) there is already a search function so this one should 1227 | # typically be disabled. For large projects the javascript based search engine 1228 | # can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. 1229 | 1230 | SEARCHENGINE = YES 1231 | 1232 | # When the SERVER_BASED_SEARCH tag is enabled the search engine will be 1233 | # implemented using a web server instead of a web client using Javascript. 1234 | # There are two flavours of web server based search depending on the 1235 | # EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for 1236 | # searching and an index file used by the script. When EXTERNAL_SEARCH is 1237 | # enabled the indexing and searching needs to be provided by external tools. 1238 | # See the manual for details. 1239 | 1240 | SERVER_BASED_SEARCH = NO 1241 | 1242 | # When EXTERNAL_SEARCH is enabled doxygen will no longer generate the PHP 1243 | # script for searching. Instead the search results are written to an XML file 1244 | # which needs to be processed by an external indexer. Doxygen will invoke an 1245 | # external search engine pointed to by the SEARCHENGINE_URL option to obtain 1246 | # the search results. Doxygen ships with an example indexer (doxyindexer) and 1247 | # search engine (doxysearch.cgi) which are based on the open source search engine 1248 | # library Xapian. See the manual for configuration details. 1249 | 1250 | EXTERNAL_SEARCH = NO 1251 | 1252 | # The SEARCHENGINE_URL should point to a search engine hosted by a web server 1253 | # which will returned the search results when EXTERNAL_SEARCH is enabled. 1254 | # Doxygen ships with an example search engine (doxysearch) which is based on 1255 | # the open source search engine library Xapian. See the manual for configuration 1256 | # details. 1257 | 1258 | SEARCHENGINE_URL = 1259 | 1260 | # When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed 1261 | # search data is written to a file for indexing by an external tool. With the 1262 | # SEARCHDATA_FILE tag the name of this file can be specified. 1263 | 1264 | SEARCHDATA_FILE = searchdata.xml 1265 | 1266 | # When SERVER_BASED_SEARCH AND EXTERNAL_SEARCH are both enabled the 1267 | # EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is 1268 | # useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple 1269 | # projects and redirect the results back to the right project. 1270 | 1271 | EXTERNAL_SEARCH_ID = 1272 | 1273 | # The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen 1274 | # projects other than the one defined by this configuration file, but that are 1275 | # all added to the same external search index. Each project needs to have a 1276 | # unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id 1277 | # of to a relative location where the documentation can be found. 1278 | # The format is: EXTRA_SEARCH_MAPPINGS = id1=loc1 id2=loc2 ... 1279 | 1280 | EXTRA_SEARCH_MAPPINGS = 1281 | 1282 | #--------------------------------------------------------------------------- 1283 | # configuration options related to the LaTeX output 1284 | #--------------------------------------------------------------------------- 1285 | 1286 | # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 1287 | # generate Latex output. 1288 | 1289 | GENERATE_LATEX = NO 1290 | 1291 | # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 1292 | # If a relative path is entered the value of OUTPUT_DIRECTORY will be 1293 | # put in front of it. If left blank `latex' will be used as the default path. 1294 | 1295 | LATEX_OUTPUT = latex 1296 | 1297 | # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be 1298 | # invoked. If left blank `latex' will be used as the default command name. 1299 | # Note that when enabling USE_PDFLATEX this option is only used for 1300 | # generating bitmaps for formulas in the HTML output, but not in the 1301 | # Makefile that is written to the output directory. 1302 | 1303 | LATEX_CMD_NAME = latex 1304 | 1305 | # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to 1306 | # generate index for LaTeX. If left blank `makeindex' will be used as the 1307 | # default command name. 1308 | 1309 | MAKEINDEX_CMD_NAME = makeindex 1310 | 1311 | # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 1312 | # LaTeX documents. This may be useful for small projects and may help to 1313 | # save some trees in general. 1314 | 1315 | COMPACT_LATEX = NO 1316 | 1317 | # The PAPER_TYPE tag can be used to set the paper type that is used 1318 | # by the printer. Possible values are: a4, letter, legal and 1319 | # executive. If left blank a4wide will be used. 1320 | 1321 | PAPER_TYPE = a4 1322 | 1323 | # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 1324 | # packages that should be included in the LaTeX output. 1325 | 1326 | EXTRA_PACKAGES = 1327 | 1328 | # The LATEX_HEADER tag can be used to specify a personal LaTeX header for 1329 | # the generated latex document. The header should contain everything until 1330 | # the first chapter. If it is left blank doxygen will generate a 1331 | # standard header. Notice: only use this tag if you know what you are doing! 1332 | 1333 | LATEX_HEADER = 1334 | 1335 | # The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for 1336 | # the generated latex document. The footer should contain everything after 1337 | # the last chapter. If it is left blank doxygen will generate a 1338 | # standard footer. Notice: only use this tag if you know what you are doing! 1339 | 1340 | LATEX_FOOTER = 1341 | 1342 | # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 1343 | # is prepared for conversion to pdf (using ps2pdf). The pdf file will 1344 | # contain links (just like the HTML output) instead of page references 1345 | # This makes the output suitable for online browsing using a pdf viewer. 1346 | 1347 | PDF_HYPERLINKS = YES 1348 | 1349 | # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 1350 | # plain latex in the generated Makefile. Set this option to YES to get a 1351 | # higher quality PDF documentation. 1352 | 1353 | USE_PDFLATEX = YES 1354 | 1355 | # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 1356 | # command to the generated LaTeX files. This will instruct LaTeX to keep 1357 | # running if errors occur, instead of asking the user for help. 1358 | # This option is also used when generating formulas in HTML. 1359 | 1360 | LATEX_BATCHMODE = NO 1361 | 1362 | # If LATEX_HIDE_INDICES is set to YES then doxygen will not 1363 | # include the index chapters (such as File Index, Compound Index, etc.) 1364 | # in the output. 1365 | 1366 | LATEX_HIDE_INDICES = NO 1367 | 1368 | # If LATEX_SOURCE_CODE is set to YES then doxygen will include 1369 | # source code with syntax highlighting in the LaTeX output. 1370 | # Note that which sources are shown also depends on other settings 1371 | # such as SOURCE_BROWSER. 1372 | 1373 | LATEX_SOURCE_CODE = NO 1374 | 1375 | # The LATEX_BIB_STYLE tag can be used to specify the style to use for the 1376 | # bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See 1377 | # http://en.wikipedia.org/wiki/BibTeX for more info. 1378 | 1379 | LATEX_BIB_STYLE = plain 1380 | 1381 | #--------------------------------------------------------------------------- 1382 | # configuration options related to the RTF output 1383 | #--------------------------------------------------------------------------- 1384 | 1385 | # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 1386 | # The RTF output is optimized for Word 97 and may not look very pretty with 1387 | # other RTF readers or editors. 1388 | 1389 | GENERATE_RTF = NO 1390 | 1391 | # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 1392 | # If a relative path is entered the value of OUTPUT_DIRECTORY will be 1393 | # put in front of it. If left blank `rtf' will be used as the default path. 1394 | 1395 | RTF_OUTPUT = rtf 1396 | 1397 | # If the COMPACT_RTF tag is set to YES Doxygen generates more compact 1398 | # RTF documents. This may be useful for small projects and may help to 1399 | # save some trees in general. 1400 | 1401 | COMPACT_RTF = NO 1402 | 1403 | # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 1404 | # will contain hyperlink fields. The RTF file will 1405 | # contain links (just like the HTML output) instead of page references. 1406 | # This makes the output suitable for online browsing using WORD or other 1407 | # programs which support those fields. 1408 | # Note: wordpad (write) and others do not support links. 1409 | 1410 | RTF_HYPERLINKS = NO 1411 | 1412 | # Load style sheet definitions from file. Syntax is similar to doxygen's 1413 | # config file, i.e. a series of assignments. You only have to provide 1414 | # replacements, missing definitions are set to their default value. 1415 | 1416 | RTF_STYLESHEET_FILE = 1417 | 1418 | # Set optional variables used in the generation of an rtf document. 1419 | # Syntax is similar to doxygen's config file. 1420 | 1421 | RTF_EXTENSIONS_FILE = 1422 | 1423 | #--------------------------------------------------------------------------- 1424 | # configuration options related to the man page output 1425 | #--------------------------------------------------------------------------- 1426 | 1427 | # If the GENERATE_MAN tag is set to YES (the default) Doxygen will 1428 | # generate man pages 1429 | 1430 | GENERATE_MAN = NO 1431 | 1432 | # The MAN_OUTPUT tag is used to specify where the man pages will be put. 1433 | # If a relative path is entered the value of OUTPUT_DIRECTORY will be 1434 | # put in front of it. If left blank `man' will be used as the default path. 1435 | 1436 | MAN_OUTPUT = man 1437 | 1438 | # The MAN_EXTENSION tag determines the extension that is added to 1439 | # the generated man pages (default is the subroutine's section .3) 1440 | 1441 | MAN_EXTENSION = .3 1442 | 1443 | # If the MAN_LINKS tag is set to YES and Doxygen generates man output, 1444 | # then it will generate one additional man file for each entity 1445 | # documented in the real man page(s). These additional files 1446 | # only source the real man page, but without them the man command 1447 | # would be unable to find the correct page. The default is NO. 1448 | 1449 | MAN_LINKS = NO 1450 | 1451 | #--------------------------------------------------------------------------- 1452 | # configuration options related to the XML output 1453 | #--------------------------------------------------------------------------- 1454 | 1455 | # If the GENERATE_XML tag is set to YES Doxygen will 1456 | # generate an XML file that captures the structure of 1457 | # the code including all documentation. 1458 | 1459 | GENERATE_XML = NO 1460 | 1461 | # The XML_OUTPUT tag is used to specify where the XML pages will be put. 1462 | # If a relative path is entered the value of OUTPUT_DIRECTORY will be 1463 | # put in front of it. If left blank `xml' will be used as the default path. 1464 | 1465 | XML_OUTPUT = xml 1466 | 1467 | # If the XML_PROGRAMLISTING tag is set to YES Doxygen will 1468 | # dump the program listings (including syntax highlighting 1469 | # and cross-referencing information) to the XML output. Note that 1470 | # enabling this will significantly increase the size of the XML output. 1471 | 1472 | XML_PROGRAMLISTING = YES 1473 | 1474 | #--------------------------------------------------------------------------- 1475 | # configuration options for the AutoGen Definitions output 1476 | #--------------------------------------------------------------------------- 1477 | 1478 | # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will 1479 | # generate an AutoGen Definitions (see autogen.sf.net) file 1480 | # that captures the structure of the code including all 1481 | # documentation. Note that this feature is still experimental 1482 | # and incomplete at the moment. 1483 | 1484 | GENERATE_AUTOGEN_DEF = NO 1485 | 1486 | #--------------------------------------------------------------------------- 1487 | # configuration options related to the Perl module output 1488 | #--------------------------------------------------------------------------- 1489 | 1490 | # If the GENERATE_PERLMOD tag is set to YES Doxygen will 1491 | # generate a Perl module file that captures the structure of 1492 | # the code including all documentation. Note that this 1493 | # feature is still experimental and incomplete at the 1494 | # moment. 1495 | 1496 | GENERATE_PERLMOD = NO 1497 | 1498 | # If the PERLMOD_LATEX tag is set to YES Doxygen will generate 1499 | # the necessary Makefile rules, Perl scripts and LaTeX code to be able 1500 | # to generate PDF and DVI output from the Perl module output. 1501 | 1502 | PERLMOD_LATEX = NO 1503 | 1504 | # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be 1505 | # nicely formatted so it can be parsed by a human reader. This is useful 1506 | # if you want to understand what is going on. On the other hand, if this 1507 | # tag is set to NO the size of the Perl module output will be much smaller 1508 | # and Perl will parse it just the same. 1509 | 1510 | PERLMOD_PRETTY = YES 1511 | 1512 | # The names of the make variables in the generated doxyrules.make file 1513 | # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. 1514 | # This is useful so different doxyrules.make files included by the same 1515 | # Makefile don't overwrite each other's variables. 1516 | 1517 | PERLMOD_MAKEVAR_PREFIX = 1518 | 1519 | #--------------------------------------------------------------------------- 1520 | # Configuration options related to the preprocessor 1521 | #--------------------------------------------------------------------------- 1522 | 1523 | # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 1524 | # evaluate all C-preprocessor directives found in the sources and include 1525 | # files. 1526 | 1527 | ENABLE_PREPROCESSING = YES 1528 | 1529 | # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 1530 | # names in the source code. If set to NO (the default) only conditional 1531 | # compilation will be performed. Macro expansion can be done in a controlled 1532 | # way by setting EXPAND_ONLY_PREDEF to YES. 1533 | 1534 | MACRO_EXPANSION = NO 1535 | 1536 | # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 1537 | # then the macro expansion is limited to the macros specified with the 1538 | # PREDEFINED and EXPAND_AS_DEFINED tags. 1539 | 1540 | EXPAND_ONLY_PREDEF = NO 1541 | 1542 | # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 1543 | # pointed to by INCLUDE_PATH will be searched when a #include is found. 1544 | 1545 | SEARCH_INCLUDES = YES 1546 | 1547 | # The INCLUDE_PATH tag can be used to specify one or more directories that 1548 | # contain include files that are not input files but should be processed by 1549 | # the preprocessor. 1550 | 1551 | INCLUDE_PATH = 1552 | 1553 | # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 1554 | # patterns (like *.h and *.hpp) to filter out the header-files in the 1555 | # directories. If left blank, the patterns specified with FILE_PATTERNS will 1556 | # be used. 1557 | 1558 | INCLUDE_FILE_PATTERNS = 1559 | 1560 | # The PREDEFINED tag can be used to specify one or more macro names that 1561 | # are defined before the preprocessor is started (similar to the -D option of 1562 | # gcc). The argument of the tag is a list of macros of the form: name 1563 | # or name=definition (no spaces). If the definition and the = are 1564 | # omitted =1 is assumed. To prevent a macro definition from being 1565 | # undefined via #undef or recursively expanded use the := operator 1566 | # instead of the = operator. 1567 | 1568 | PREDEFINED = 1569 | 1570 | # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then 1571 | # this tag can be used to specify a list of macro names that should be expanded. 1572 | # The macro definition that is found in the sources will be used. 1573 | # Use the PREDEFINED tag if you want to use a different macro definition that 1574 | # overrules the definition found in the source code. 1575 | 1576 | EXPAND_AS_DEFINED = 1577 | 1578 | # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then 1579 | # doxygen's preprocessor will remove all references to function-like macros 1580 | # that are alone on a line, have an all uppercase name, and do not end with a 1581 | # semicolon, because these will confuse the parser if not removed. 1582 | 1583 | SKIP_FUNCTION_MACROS = YES 1584 | 1585 | #--------------------------------------------------------------------------- 1586 | # Configuration::additions related to external references 1587 | #--------------------------------------------------------------------------- 1588 | 1589 | # The TAGFILES option can be used to specify one or more tagfiles. For each 1590 | # tag file the location of the external documentation should be added. The 1591 | # format of a tag file without this location is as follows: 1592 | # TAGFILES = file1 file2 ... 1593 | # Adding location for the tag files is done as follows: 1594 | # TAGFILES = file1=loc1 "file2 = loc2" ... 1595 | # where "loc1" and "loc2" can be relative or absolute paths 1596 | # or URLs. Note that each tag file must have a unique name (where the name does 1597 | # NOT include the path). If a tag file is not located in the directory in which 1598 | # doxygen is run, you must also specify the path to the tagfile here. 1599 | 1600 | TAGFILES = 1601 | 1602 | # When a file name is specified after GENERATE_TAGFILE, doxygen will create 1603 | # a tag file that is based on the input files it reads. 1604 | 1605 | GENERATE_TAGFILE = 1606 | 1607 | # If the ALLEXTERNALS tag is set to YES all external classes will be listed 1608 | # in the class index. If set to NO only the inherited external classes 1609 | # will be listed. 1610 | 1611 | ALLEXTERNALS = NO 1612 | 1613 | # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed 1614 | # in the modules index. If set to NO, only the current project's groups will 1615 | # be listed. 1616 | 1617 | EXTERNAL_GROUPS = YES 1618 | 1619 | # The PERL_PATH should be the absolute path and name of the perl script 1620 | # interpreter (i.e. the result of `which perl'). 1621 | 1622 | PERL_PATH = /usr/bin/perl 1623 | 1624 | #--------------------------------------------------------------------------- 1625 | # Configuration options related to the dot tool 1626 | #--------------------------------------------------------------------------- 1627 | 1628 | # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 1629 | # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base 1630 | # or super classes. Setting the tag to NO turns the diagrams off. Note that 1631 | # this option also works with HAVE_DOT disabled, but it is recommended to 1632 | # install and use dot, since it yields more powerful graphs. 1633 | 1634 | CLASS_DIAGRAMS = YES 1635 | 1636 | # You can define message sequence charts within doxygen comments using the \msc 1637 | # command. Doxygen will then run the mscgen tool (see 1638 | # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the 1639 | # documentation. The MSCGEN_PATH tag allows you to specify the directory where 1640 | # the mscgen tool resides. If left empty the tool is assumed to be found in the 1641 | # default search path. 1642 | 1643 | MSCGEN_PATH = 1644 | 1645 | # If set to YES, the inheritance and collaboration graphs will hide 1646 | # inheritance and usage relations if the target is undocumented 1647 | # or is not a class. 1648 | 1649 | HIDE_UNDOC_RELATIONS = YES 1650 | 1651 | # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 1652 | # available from the path. This tool is part of Graphviz, a graph visualization 1653 | # toolkit from AT&T and Lucent Bell Labs. The other options in this section 1654 | # have no effect if this option is set to NO (the default) 1655 | 1656 | HAVE_DOT = YES 1657 | 1658 | # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is 1659 | # allowed to run in parallel. When set to 0 (the default) doxygen will 1660 | # base this on the number of processors available in the system. You can set it 1661 | # explicitly to a value larger than 0 to get control over the balance 1662 | # between CPU load and processing speed. 1663 | 1664 | DOT_NUM_THREADS = 0 1665 | 1666 | # By default doxygen will use the Helvetica font for all dot files that 1667 | # doxygen generates. When you want a differently looking font you can specify 1668 | # the font name using DOT_FONTNAME. You need to make sure dot is able to find 1669 | # the font, which can be done by putting it in a standard location or by setting 1670 | # the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the 1671 | # directory containing the font. 1672 | 1673 | DOT_FONTNAME = Helvetica 1674 | 1675 | # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. 1676 | # The default size is 10pt. 1677 | 1678 | DOT_FONTSIZE = 10 1679 | 1680 | # By default doxygen will tell dot to use the Helvetica font. 1681 | # If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to 1682 | # set the path where dot can find it. 1683 | 1684 | DOT_FONTPATH = 1685 | 1686 | # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 1687 | # will generate a graph for each documented class showing the direct and 1688 | # indirect inheritance relations. Setting this tag to YES will force the 1689 | # CLASS_DIAGRAMS tag to NO. 1690 | 1691 | CLASS_GRAPH = YES 1692 | 1693 | # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 1694 | # will generate a graph for each documented class showing the direct and 1695 | # indirect implementation dependencies (inheritance, containment, and 1696 | # class references variables) of the class with other documented classes. 1697 | 1698 | COLLABORATION_GRAPH = YES 1699 | 1700 | # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen 1701 | # will generate a graph for groups, showing the direct groups dependencies 1702 | 1703 | GROUP_GRAPHS = YES 1704 | 1705 | # If the UML_LOOK tag is set to YES doxygen will generate inheritance and 1706 | # collaboration diagrams in a style similar to the OMG's Unified Modeling 1707 | # Language. 1708 | 1709 | UML_LOOK = NO 1710 | 1711 | # If the UML_LOOK tag is enabled, the fields and methods are shown inside 1712 | # the class node. If there are many fields or methods and many nodes the 1713 | # graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS 1714 | # threshold limits the number of items for each type to make the size more 1715 | # managable. Set this to 0 for no limit. Note that the threshold may be 1716 | # exceeded by 50% before the limit is enforced. 1717 | 1718 | UML_LIMIT_NUM_FIELDS = 10 1719 | 1720 | # If set to YES, the inheritance and collaboration graphs will show the 1721 | # relations between templates and their instances. 1722 | 1723 | TEMPLATE_RELATIONS = NO 1724 | 1725 | # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT 1726 | # tags are set to YES then doxygen will generate a graph for each documented 1727 | # file showing the direct and indirect include dependencies of the file with 1728 | # other documented files. 1729 | 1730 | INCLUDE_GRAPH = YES 1731 | 1732 | # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and 1733 | # HAVE_DOT tags are set to YES then doxygen will generate a graph for each 1734 | # documented header file showing the documented files that directly or 1735 | # indirectly include this file. 1736 | 1737 | INCLUDED_BY_GRAPH = YES 1738 | 1739 | # If the CALL_GRAPH and HAVE_DOT options are set to YES then 1740 | # doxygen will generate a call dependency graph for every global function 1741 | # or class method. Note that enabling this option will significantly increase 1742 | # the time of a run. So in most cases it will be better to enable call graphs 1743 | # for selected functions only using the \callgraph command. 1744 | 1745 | CALL_GRAPH = YES 1746 | 1747 | # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then 1748 | # doxygen will generate a caller dependency graph for every global function 1749 | # or class method. Note that enabling this option will significantly increase 1750 | # the time of a run. So in most cases it will be better to enable caller 1751 | # graphs for selected functions only using the \callergraph command. 1752 | 1753 | CALLER_GRAPH = YES 1754 | 1755 | # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 1756 | # will generate a graphical hierarchy of all classes instead of a textual one. 1757 | 1758 | GRAPHICAL_HIERARCHY = YES 1759 | 1760 | # If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES 1761 | # then doxygen will show the dependencies a directory has on other directories 1762 | # in a graphical way. The dependency relations are determined by the #include 1763 | # relations between the files in the directories. 1764 | 1765 | DIRECTORY_GRAPH = YES 1766 | 1767 | # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images 1768 | # generated by dot. Possible values are svg, png, jpg, or gif. 1769 | # If left blank png will be used. If you choose svg you need to set 1770 | # HTML_FILE_EXTENSION to xhtml in order to make the SVG files 1771 | # visible in IE 9+ (other browsers do not have this requirement). 1772 | 1773 | DOT_IMAGE_FORMAT = png 1774 | 1775 | # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to 1776 | # enable generation of interactive SVG images that allow zooming and panning. 1777 | # Note that this requires a modern browser other than Internet Explorer. 1778 | # Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you 1779 | # need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files 1780 | # visible. Older versions of IE do not have SVG support. 1781 | 1782 | INTERACTIVE_SVG = NO 1783 | 1784 | # The tag DOT_PATH can be used to specify the path where the dot tool can be 1785 | # found. If left blank, it is assumed the dot tool can be found in the path. 1786 | 1787 | DOT_PATH = 1788 | 1789 | # The DOTFILE_DIRS tag can be used to specify one or more directories that 1790 | # contain dot files that are included in the documentation (see the 1791 | # \dotfile command). 1792 | 1793 | DOTFILE_DIRS = 1794 | 1795 | # The MSCFILE_DIRS tag can be used to specify one or more directories that 1796 | # contain msc files that are included in the documentation (see the 1797 | # \mscfile command). 1798 | 1799 | MSCFILE_DIRS = 1800 | 1801 | # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of 1802 | # nodes that will be shown in the graph. If the number of nodes in a graph 1803 | # becomes larger than this value, doxygen will truncate the graph, which is 1804 | # visualized by representing a node as a red box. Note that doxygen if the 1805 | # number of direct children of the root node in a graph is already larger than 1806 | # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note 1807 | # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. 1808 | 1809 | DOT_GRAPH_MAX_NODES = 50 1810 | 1811 | # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the 1812 | # graphs generated by dot. A depth value of 3 means that only nodes reachable 1813 | # from the root by following a path via at most 3 edges will be shown. Nodes 1814 | # that lay further from the root node will be omitted. Note that setting this 1815 | # option to 1 or 2 may greatly reduce the computation time needed for large 1816 | # code bases. Also note that the size of a graph can be further restricted by 1817 | # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. 1818 | 1819 | MAX_DOT_GRAPH_DEPTH = 0 1820 | 1821 | # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent 1822 | # background. This is disabled by default, because dot on Windows does not 1823 | # seem to support this out of the box. Warning: Depending on the platform used, 1824 | # enabling this option may lead to badly anti-aliased labels on the edges of 1825 | # a graph (i.e. they become hard to read). 1826 | 1827 | DOT_TRANSPARENT = NO 1828 | 1829 | # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output 1830 | # files in one run (i.e. multiple -o and -T options on the command line). This 1831 | # makes dot run faster, but since only newer versions of dot (>1.8.10) 1832 | # support this, this feature is disabled by default. 1833 | 1834 | DOT_MULTI_TARGETS = NO 1835 | 1836 | # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 1837 | # generate a legend page explaining the meaning of the various boxes and 1838 | # arrows in the dot generated graphs. 1839 | 1840 | GENERATE_LEGEND = YES 1841 | 1842 | # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will 1843 | # remove the intermediate dot files that are used to generate 1844 | # the various graphs. 1845 | 1846 | DOT_CLEANUP = YES 1847 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013-2018 Sebastien Rombauts (sebastien.rombauts@gmail.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is furnished 10 | to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 20 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | LoggerC++ 2 | --------- 3 | 4 | [![Travis CI Linux Build Status](https://travis-ci.org/SRombauts/LoggerCpp.svg)](https://travis-ci.org/SRombauts/LoggerCpp "Travis CI Linux Build Status") 5 | 6 | LoggerC++ (LoggerCpp) is a simple, elegant and efficient C++ logger library. 7 | 8 | ### The goals of LoggerC++ are: 9 | 10 | - to keep dependencies to a minimum (STL and shared_ptr) 11 | - to be portable 12 | - to minimize cpu utilisation when no log are outputed 13 | - to be thread-safe (output logs in same channel accross multiple threads) 14 | - to be well documented with Doxygen tags 15 | - to use a permissive MIT license, similar to BSD or Boost, for proprietary/commercial usage 16 | 17 | ### Limitations: 18 | 19 | Thread-safety is only for Log outputs. 20 | You shall not dynamically create and destroy Logger objects in multiple threads. 21 | Instead, build them all at startup in you main thread, before other thread startup. 22 | Then you are allowed to use them all in parallel. 23 | 24 | ### Suported platforms: 25 | 26 | Developements and tests are done under the following OSs : 27 | - Ubuntu 14.04 and 16.04 28 | - Windows 10 29 | And following IDEs/Compilers 30 | - GCC 4.8 and clang 5 31 | - Visual Studio Community 2017 32 | 33 | ### Dependencies: 34 | 35 | - a STL implementation with RTTI (even an old one, like the one provided with VC6 should work). 36 | - optionnaly: the C++ 11 std::shared_ptr or boost::shared_ptr (a minimal shared_ptr implementation is provided). 37 | 38 | ### Installation 39 | 40 | To use this C++ Logger, you need to include the sources files into your project codebase. 41 | 42 | ### License 43 | 44 | Copyright (c) 2013-2018 Sébastien Rombauts (sebastien.rombauts@gmail.com) 45 | 46 | Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt 47 | or copy at http://opensource.org/licenses/MIT) 48 | 49 | ## Getting started 50 | ### Principles 51 | 52 | - Add a small named Logger object to your code to output logs prefixed by the given name. 53 | A Logger is as small as a shared_ptr, typicaly 8 bytes. 54 | Use it as a member variable to your class, or as a free variable. 55 | - Build a Log with standard stream manipulations (like with std::cout) 56 | but in a thread-safe manner: the Log is outputed atomically at the end of the line. 57 | - Use one of the 6 Log Level, ranging from Debug to Critic in a standard fashion. 58 | - Set the Channel Level of the Logger to dynamicaly filter Log to be outputed 59 | - Multiple Logger objects with the same name will share the same underlying named Channel. 60 | Any of theses Logger can manipulate the Channel output Level. 61 | - Configure the availlable Output objects, for console, file or MSVC Debugger output. 62 | 63 | ### First sample demonstrates how to create a Logger and print some logs: 64 | 65 | ```C++ 66 | int main () 67 | { 68 | // Configure the default severity Level of new Channel objects 69 | Log::Manager::setDefaultLevel(Log::Log::eNotice); 70 | 71 | // Setup the list of Config for the Output objects, 72 | Log::Config::Vector configList; 73 | Log::Config::addOutput(configList, "OutputConsole"); 74 | Log::Config::addOutput(configList, "OutputFile"); 75 | Log::Config::setOption(configList, "filename", "log.txt"); 76 | Log::Config::setOption(configList, "max_size", "10000"); 77 | // and configure the Log Manager (create the Output objects) 78 | Log::Manager::configure(configList); 79 | 80 | // Create a Logger object, using a "Main.Example" Channel 81 | Log::Logger logger("Main.Example"); 82 | 83 | // Test outputs of various kind of variables, and some common stream manipulations. 84 | std::string str("string"); 85 | unsigned int ui = 123; 86 | double dbl = -0.023f; 87 | logger.debug() << "Variables ; '" << str << "', '" << ui << "', '" << dbl << "'"; 88 | logger.debug() << "Hexa = " << std::hex << 0x75af0 << " test"; 89 | logger.debug() << "Deci = " << std::right << std::setfill('0') << std::setw(8) << 76035 << " test"; 90 | 91 | // Test outputs of various severity Level 92 | logger.debug() << "Debug."; 93 | logger.info() << "Info."; 94 | logger.notice() << "Notice."; 95 | logger.warning()<< "Warning."; 96 | logger.error() << "Error."; 97 | logger.critic() << "Critic."; 98 | 99 | // Modify the output Level of the underlying Channel, and test various severity Level again 100 | logger.setLevel(Log::Log::eWarning); 101 | logger.debug() << "NO Debug."; // NO more debug logs 102 | logger.info() << "NO Info."; // NO more info logs 103 | logger.notice() << "NO Notice."; // NO more notice logs 104 | logger.warning()<< "Warning."; 105 | logger.error() << "Error."; 106 | logger.critic() << "Critic."; 107 | 108 | // Reset Level of the "Main.example" channel by its name 109 | Log::Manager::get("Main.Example")->setLevel(Log::Log::eDebug); 110 | ``` 111 | 112 | ## How to contribute 113 | ### GitHub website 114 | The most efficient way to help and contribute to this wrapper project is to 115 | use the tools provided by GitHub: 116 | - please fill bug reports and feature requests here: https://github.com/SRombauts/LoggerCpp/issues 117 | - fork the repository, make some small changes and submit them with pull-request 118 | 119 | ### Contact 120 | You can also email me directly, I will answer any questions and requests. 121 | 122 | ### Coding Style Guidelines 123 | The source code use the CamelCase naming style variant where : 124 | - type names (class, struct, typedef, enums...) begins with a capital letter 125 | - files (.cpp/.h) are named like the class they contains 126 | - function and variable names begins with a lower case letter 127 | - member variables begins with a 'm', function arguments begins with a 'a', boolean with a 'b', pointers with a 'p' 128 | - each file, class, method and member variable is documented using Doxygen tags 129 | See also http://www.appinf.com/download/CppCodingStyleGuide.pdf for good guidelines 130 | 131 | ### Continuous Integration 132 | 133 | This project is continuously tested under Ubuntu Linux with the gcc and clang compilers 134 | using the Travis CI community service with the above CMake building and testing procedure. 135 | 136 | Detailed results can be seen online: https://travis-ci.org/SRombauts/LoggerCpp 137 | -------------------------------------------------------------------------------- /TODO.txt: -------------------------------------------------------------------------------- 1 | Update shared_ptr to tag v1.0 2 | 3 | test 4 | 5 | Github Pages 6 | 7 | Release 8 | 9 | Manager: configure channels 10 | 11 | Add a basic thread-safety security (throw if multiple threads create Loggers) 12 | - Add a static Thread::getCurrentId() 13 | 14 | Searching for a more compact or standard output format 15 | - XML 16 | - HTML 17 | - json 18 | - db3 19 | - no SQL 20 | - google protocol buffer 21 | - message pack -------------------------------------------------------------------------------- /build.bat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SRombauts/LoggerCpp/a0868a8bc8fb0457a7f2e9109f4715a4d3d6af3b/build.bat -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013-2018 Sébastien Rombauts (sebastien.rombauts@gmail.com) 2 | # 3 | # Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt 4 | # or copy at http://opensource.org/licenses/MIT) 5 | mkdir -p build 6 | cd build 7 | cmake .. 8 | cmake --build . 9 | # ctest . -------------------------------------------------------------------------------- /examples/Main.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Main.cpp 3 | * @brief Example program for the simple LoggerC++ system 4 | * 5 | * Copyright (c) 2013-2018 Sebastien Rombauts (sebastien.rombauts@gmail.com) 6 | * 7 | * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt 8 | * or copy at http://opensource.org/licenses/MIT) 9 | */ 10 | 11 | #include 12 | 13 | #include // used for cerr messages 14 | 15 | 16 | /** 17 | * @brief Simple test class 18 | */ 19 | class Tester { 20 | public: 21 | Tester() : 22 | mLogger("main.Tester") 23 | { 24 | } 25 | 26 | void constTest (void) const { 27 | mLogger.debug() << "log within a const method"; 28 | } 29 | 30 | private: 31 | Log::Logger mLogger; ///< A named logger to produce log 32 | }; 33 | 34 | 35 | 36 | /** 37 | * @brief Simple example program 38 | */ 39 | int main () 40 | { 41 | // Configure the default severity Level of new Channel objects 42 | #ifndef NDEBUG 43 | Log::Manager::setDefaultLevel(Log::Log::eDebug); 44 | #else 45 | Log::Manager::setDefaultLevel(Log::Log::eNotice); 46 | #endif 47 | 48 | // Configure the Output objects 49 | Log::Config::Vector configList; 50 | Log::Config::addOutput(configList, "OutputConsole"); 51 | Log::Config::addOutput(configList, "OutputFile"); 52 | Log::Config::setOption(configList, "filename", "log.txt"); 53 | Log::Config::setOption(configList, "filename_old", "log.old.txt"); 54 | Log::Config::setOption(configList, "max_startup_size", "0"); 55 | Log::Config::setOption(configList, "max_size", "10000"); 56 | #ifdef WIN32 57 | Log::Config::addOutput(configList, "OutputDebug"); 58 | #endif 59 | 60 | // Create a Logger object, using a "Main.Example" Channel 61 | Log::Logger logger("Main.Example"); 62 | logger.warning() << "NO logs before configure()"; 63 | 64 | try 65 | { 66 | // Configure the Log Manager (create the Output objects) 67 | Log::Manager::configure(configList); 68 | } 69 | catch (std::exception& e) 70 | { 71 | std::cerr << e.what(); 72 | } 73 | 74 | // Test outputs of various kind of variables, and some common stream manipulations. 75 | std::string str("string"); 76 | unsigned int ui = 123; 77 | double dbl = -0.023f; 78 | logger.debug() << "Variables ; '" << str << "', '" << ui << "', '" << dbl << "'"; 79 | logger.debug() << "Hexa = " << std::hex << 0x75af0 << " test"; 80 | logger.debug() << "Deci = " << std::right << std::setfill('0') << std::setw(8) << 76035 << " test"; 81 | logger.debug() << "sizeof(logger)=" << sizeof(logger); 82 | 83 | // Test outputs of various severity Level 84 | logger.debug() << "Debug."; 85 | logger.info() << "Info."; 86 | logger.notice() << "Notice."; 87 | logger.warning()<< "Warning."; 88 | logger.error() << "Error."; 89 | logger.critic() << "Critic."; 90 | 91 | // Modify the output Level of the underlying Channel, and test various severity Level again 92 | logger.setLevel(Log::Log::eWarning); 93 | logger.debug() << "NO Debug."; // NO more debug logs 94 | logger.info() << "NO Info."; // NO more info logs 95 | logger.notice() << "NO Notice."; // NO more notice logs 96 | logger.warning()<< "Warning."; 97 | logger.error() << "Error."; 98 | logger.critic() << "Critic."; 99 | 100 | // Reset Level of the "Main.example" channel by its name 101 | Log::Manager::get("Main.Example")->setLevel(Log::Log::eDebug); 102 | 103 | // Create other loggers, sharing the "Main.Example" Channel, and creating a new one 104 | Log::Logger logger2("Main.Example"); 105 | Log::Logger logger3("Main.Other"); 106 | logger.debug() << "First logger to the Channel"; 107 | logger2.debug() << "Second logger to the Channel"; 108 | logger3.debug() << "Third logger, other Channel"; 109 | // Modify the Level of the "Main.example" channel by its name 110 | Log::Manager::get("Main.Example")->setLevel(Log::Log::eInfo); 111 | logger.debug() << "first logger inhibited"; // NO more debug logs for this logger 112 | logger2.debug() << "second logger also disabled"; // NO more debug logs (sharing the same underlying channel) 113 | logger3.debug() << "third logger still active"; 114 | // Reset the Level of the "Main.example" channel by its name 115 | Log::Manager::get("Main.Example")->setLevel(Log::Log::eDebug); 116 | logger.debug() << "first logger re-activated"; 117 | logger2.debug() << "second logger also re-activated"; 118 | logger3.debug() << "third logger always active"; 119 | 120 | // Create an object using a Logger as member variable 121 | Tester tester; 122 | tester.constTest(); 123 | 124 | // Show how to get the current Channel configuration (to save it to a file, for instance) 125 | Log::Manager::get("Main.OtherChannel")->setLevel(Log::Log::eNotice); 126 | Log::Config::Ptr ChannelConfigPtr = Log::Manager::getChannelConfig(); 127 | // Show how to set the current Channel configuration (restored from a file, for instance) 128 | Log::Manager::setChannelConfig(ChannelConfigPtr); 129 | 130 | // Terminate the Log Manager (destroy the Output objects) 131 | Log::Manager::terminate(); 132 | logger.warning() << "NO more logs after terminate()"; 133 | 134 | return 0; 135 | } 136 | -------------------------------------------------------------------------------- /include/LoggerCpp/Channel.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Channel.h 3 | * @ingroup LoggerCpp 4 | * @brief The named channel shared by Logger objects using the same name 5 | * 6 | * Copyright (c) 2013-2018 Sebastien Rombauts (sebastien.rombauts@gmail.com) 7 | * 8 | * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt 9 | * or copy at http://opensource.org/licenses/MIT) 10 | */ 11 | #pragma once 12 | 13 | #include 14 | 15 | #include 16 | #include 17 | 18 | // The following includes "boost/shared_ptr.hpp" if LOGGER_USE_BOOST_SHARED_PTR is defined, 19 | // or (or ) when C++11 (or experimental C++0x) is available, 20 | // or a custom minimal shared_ptr implementation, 21 | // and imports the "shared_ptr" symbol inside the Log namespace (ie. Log::shared_ptr) 22 | #include 23 | 24 | 25 | namespace Log { 26 | 27 | 28 | /** 29 | * @brief The named channel shared by Logger objects using the same name 30 | * @ingroup LoggerCpp 31 | * 32 | * A Channel is the underlying object used by one or many Logger objects to 33 | * associate a named prefix and an output Log::Level. 34 | * Sharing a same Channel between multiple Logger enable changing the 35 | * Level of many Logger objects at once. 36 | */ 37 | class Channel { 38 | public: 39 | /// @brief Shared Pointer to a Channel object 40 | typedef shared_ptr Ptr; 41 | /// @brief Map of shared pointer of Channel objects 42 | typedef std::map Map; 43 | 44 | public: 45 | /** 46 | * @brief Initialize a named Channel 47 | * 48 | * @param[in] apChannelName String to identify origin of Log output by this Channel 49 | * @param[in] aChannelLevel The default minimum Log::Level of severity from which to output Log 50 | */ 51 | Channel(const char* apChannelName, Log::Level aChannelLevel) : 52 | mName(apChannelName), 53 | mLevel(aChannelLevel) 54 | {} 55 | 56 | /// @brief Non virtual destructor 57 | ~Channel(void) { 58 | } 59 | 60 | /// @brief Name of the Channel 61 | inline const std::string& getName(void) const { 62 | return mName; 63 | } 64 | 65 | /// @brief Set the current output Log::Level of the Channel 66 | inline void setLevel(Log::Level aLevel) { 67 | mLevel = aLevel; 68 | } 69 | 70 | /// @brief Current Log::Level of the Channel 71 | inline Log::Level getLevel(void) const { 72 | return mLevel; 73 | } 74 | 75 | private: 76 | /// @{ Non-copyable object 77 | Channel(Channel&); 78 | void operator=(Channel&); 79 | /// @} 80 | 81 | private: 82 | std::string mName; ///< Name of the Channel 83 | Log::Level mLevel; ///< Current Log::Level of the Channel 84 | }; 85 | 86 | 87 | } // namespace Log 88 | -------------------------------------------------------------------------------- /include/LoggerCpp/Config.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Config.h 3 | * @ingroup LoggerCpp 4 | * @brief Configuration for an Output object 5 | * 6 | * Copyright (c) 2013-2018 Sebastien Rombauts (sebastien.rombauts@gmail.com) 7 | * 8 | * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt 9 | * or copy at http://opensource.org/licenses/MIT) 10 | */ 11 | #pragma once 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | // The following includes "boost/shared_ptr.hpp" if LOGGER_USE_BOOST_SHARED_PTR is defined, 18 | // or (or ) when C++11 (or experimental C++0x) is available, 19 | // or a custom minimal shared_ptr implementation, 20 | // and imports the "shared_ptr" symbol inside the Log namespace (ie. Log::shared_ptr) 21 | #include 22 | 23 | 24 | namespace Log { 25 | 26 | 27 | // forward declaration 28 | class Logger; 29 | 30 | 31 | /** 32 | * @brief Configuration for an Output object 33 | * @ingroup LoggerCpp 34 | * 35 | * A Config object is an associative container of strings key and values, 36 | * with easy to use helper manipulation functions. 37 | */ 38 | class Config { 39 | public: 40 | /// @brief Shared Pointer to a Config object 41 | typedef shared_ptr Ptr; 42 | /// @brief List of Config objects 43 | typedef std::vector Vector; 44 | /// @brief Map of string values 45 | typedef std::map Values; 46 | 47 | public: 48 | /** 49 | * @brief Constructor 50 | * 51 | * @param[in] apName Name of the Config object 52 | */ 53 | explicit Config(const char* apName); 54 | 55 | /// @brief Non virtual destructor 56 | ~Config(void); 57 | 58 | /// @brief Get the name of this Config object 59 | inline const std::string& getName(void) const { 60 | return mName; 61 | } 62 | 63 | /// @brief Get the string values of this Config object 64 | inline const Values& getValues(void) const { 65 | return mValues; 66 | } 67 | 68 | /** 69 | * @brief Set a string value 70 | * 71 | * @param[in] apKey String key identifying the string value 72 | * @param[in] apValue String value associated to the given key 73 | */ 74 | inline void setValue(const char* apKey, const char* apValue) { 75 | mValues[apKey] = apValue; 76 | } 77 | 78 | /** 79 | * @brief Get a string value, or return the provided default one 80 | * 81 | * @param[in] apKey String key identifying the string value 82 | * @param[in] apDefaultValue String default value 83 | * 84 | * @return String value associated to the given key 85 | */ 86 | const char* get(const char* apKey, const char* apDefaultValue) const; 87 | 88 | /** 89 | * @brief Get a long value, or return the provided default one 90 | * 91 | * @param[in] apKey String key identifying the string value 92 | * @param[in] aDefaultValue Long default value 93 | * 94 | * @return Long value associated to the given key 95 | */ 96 | long get(const char* apKey, const long aDefaultValue) const; 97 | 98 | public: 99 | /** 100 | * @brief Create the Config for a new Output 101 | * 102 | * @param[in,out] aConfigList Config list to complete with a new Output 103 | * @param[in] apOutputName Name of the new Output 104 | */ 105 | 106 | static void addOutput(Vector& aConfigList, const char* apOutputName); 107 | /** 108 | * @brief Set an option for the last added Output 109 | * 110 | * @param[in,out] aConfigList Config list to complete with a new option value 111 | * @param[in] apKey String key identifying the string value 112 | * @param[in] apValue String value associated to the given key 113 | */ 114 | static void setOption(Vector& aConfigList, const char* apKey, const char* apValue); 115 | 116 | private: 117 | std::string mName; ///< Name of the Config 118 | Values mValues; ///< Map of string values 119 | }; 120 | 121 | 122 | } // namespace Log 123 | 124 | -------------------------------------------------------------------------------- /include/LoggerCpp/DateTime.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file DateTime.h 3 | * @ingroup LoggerCpp 4 | * @brief Current time precise to the millisecond. 5 | * 6 | * Copyright (c) 2013-2018 Sebastien Rombauts (sebastien.rombauts@gmail.com) 7 | * 8 | * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt 9 | * or copy at http://opensource.org/licenses/MIT) 10 | */ 11 | #pragma once 12 | 13 | 14 | namespace Log { 15 | 16 | 17 | /** 18 | * @brief Current time precise to the millisecond. 19 | * @ingroup LoggerCpp 20 | * 21 | * Using a struct to enable easy direct access to public members. 22 | * 23 | * Under Windows, the time is given to the millisecond. 24 | * Under Linux, the time is given to the microsecond. 25 | */ 26 | struct DateTime { 27 | /** 28 | * @brief Constructor 29 | */ 30 | DateTime(void); 31 | 32 | /** 33 | * @brief Set to current time 34 | */ 35 | void make(void); 36 | 37 | int year; ///< year [0,30827] 38 | int month; ///< month [1,12] 39 | int day; ///< day [1,31] 40 | int hour; ///< hour [0,23] 41 | int minute; ///< minute [0,59] 42 | int second; ///< second [0,59] 43 | int ms; ///< millisecond 44 | int us; ///< microsecond (not under Windows) 45 | }; 46 | 47 | 48 | } // namespace Log 49 | -------------------------------------------------------------------------------- /include/LoggerCpp/Exception.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Exception.h 3 | * @ingroup LoggerCpp 4 | * @brief Encapsulation of an error message on a std::runtime_error. 5 | * 6 | * Copyright (c) 2012-2013-2018 Sebastien Rombauts (sebastien.rombauts@gmail.com) 7 | * 8 | * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt 9 | * or copy at http://opensource.org/licenses/MIT) 10 | */ 11 | #pragma once 12 | 13 | #include 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | 20 | /// assert() is used in destructors, where exceptions are not allowed 21 | /// (only asserting in debug mode) 22 | /// @todo Enable assertion callback like in SQLiteC++ 23 | #define LOGGER_ASSERT(expression) assert(expression) 24 | 25 | 26 | 27 | #ifdef _WIN32 28 | // Disable warning C4290: C++ exception specification ignored except to indicate a function is not __declspec(nothrow) 29 | #pragma warning(disable:4290) 30 | #endif 31 | 32 | 33 | namespace Log { 34 | 35 | /** 36 | * @brief Encapsulation of an error message based on std::runtime_error. 37 | * @ingroup LoggerCpp 38 | */ 39 | class Exception : public std::runtime_error { 40 | public: 41 | /** 42 | * @brief Encapsulation of an error message based on std::runtime_error. 43 | * 44 | * @param[in] aErrorMessage The string message describing the error 45 | */ 46 | explicit Exception(const std::string& aErrorMessage) : 47 | std::runtime_error(aErrorMessage) 48 | {} 49 | }; 50 | 51 | 52 | /// @brief Stringify 1/2 : convert an integer to a string (using the following macro) 53 | #define TOSTRING(x) _XSTRING(x) 54 | /// @brief Stringify 2/2 : convert an integer to a string (inner macro) 55 | #define _XSTRING(x) #x 56 | 57 | #ifdef __FUNCTION__ 58 | /// @brief Define __func__ under Windows, to use the same name as with GCC 59 | #define __func__ __FUNCTION__ 60 | #endif 61 | 62 | /// @brief Helper macro to throw an Exception with file/line/function information, using the string stream Formatter 63 | #define LOGGER_THROW(x) throw Exception(Formatter() << __FILE__ << ":" << TOSTRING(__LINE__) << ": " << __func__ << "(): " << x) 64 | 65 | 66 | } // namespace Log 67 | -------------------------------------------------------------------------------- /include/LoggerCpp/Formatter.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Formatter.h 3 | * @ingroup LoggerCpp 4 | * @brief A standard string stream formatter with implicit string conversion 5 | * 6 | * Copyright (c) 2013-2018 Sebastien Rombauts (sebastien.rombauts@gmail.com) 7 | * 8 | * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt 9 | * or copy at http://opensource.org/licenses/MIT) 10 | */ 11 | #pragma once 12 | 13 | #include 14 | #include 15 | 16 | 17 | namespace Log { 18 | 19 | /** 20 | * @brief A standard string stream formatter with implicit string conversion 21 | * @ingroup LoggerCpp 22 | * 23 | * It is constructed and initialized by a call to the Formatter() constructor. 24 | * Is is then used by successive standard stream call "<<" to insert data into the stream. 25 | * It is ultimately implicitly converted to std::string when required. 26 | * 27 | * A typical use case is to format a std::exception string message : 28 | * - throw std::runtime_error(Formatter() << "no value for key '" << apKey << "'"); 29 | */ 30 | class Formatter { 31 | public: 32 | /// @brief Constructor 33 | Formatter(void) {} 34 | /// @brief Non virtual destructor 35 | ~Formatter(void) {} 36 | 37 | /** 38 | * @brief stream inserter operator 39 | * 40 | * @param[in] aValue Value to be formatted and inserted into the string stream 41 | * 42 | * @return Current Formatter instance 43 | */ 44 | template 45 | Formatter& operator<< (const T& aValue) { 46 | mStream << aValue; 47 | return (*this); 48 | } 49 | 50 | /// @brief std::string cast operator for implicit conversion 51 | inline operator std::string() const { 52 | return mStream.str(); 53 | } 54 | 55 | private: 56 | /// @{ Non-copyable object 57 | Formatter(const Formatter&); 58 | void operator=(const Formatter&); 59 | /// @} 60 | 61 | private: 62 | std::ostringstream mStream; ///< The underlying string stream 63 | }; 64 | 65 | 66 | } // namespace Log 67 | 68 | -------------------------------------------------------------------------------- /include/LoggerCpp/Log.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Log.h 3 | * @ingroup LoggerCpp 4 | * @brief A RAII (private) log object constructed by the Logger class 5 | * 6 | * Copyright (c) 2013-2018 Sebastien Rombauts (sebastien.rombauts@gmail.com) 7 | * 8 | * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt 9 | * or copy at http://opensource.org/licenses/MIT) 10 | */ 11 | #pragma once 12 | 13 | #include 14 | #include 15 | 16 | #include 17 | #include // For easy use of parametric manipulators (setfill, setprecision) by client code 18 | 19 | 20 | namespace Log { 21 | 22 | 23 | // forward declaration 24 | class Logger; 25 | 26 | 27 | /** 28 | * @brief A RAII (private) log object constructed by the Logger class 29 | * @ingroup LoggerCpp 30 | * 31 | * a Log represents a full line of log, at a certain Log::Level of severity. 32 | * 33 | * It is constructed and initialized by a call to Logger::debug(), 34 | * Logger::info(), ... or Logger::critic(). 35 | * Is is then used by successive stream call "<<", and is naturally terminated 36 | * by it destructor at the end of the line, calling the Logger::output() method. 37 | * 38 | * It contains all required information for further formating, printing and transmitting 39 | * by the Logger class. 40 | */ 41 | class Log { 42 | friend class Logger; 43 | 44 | public: 45 | /** 46 | * @brief Enumeration of the severity levels 47 | */ 48 | enum Level { 49 | eDebug = 0, 50 | eInfo, 51 | eNotice, 52 | eWarning, 53 | eError, 54 | eCritic 55 | }; 56 | 57 | public: 58 | /** 59 | * @brief stream inserter operator 60 | * 61 | * @param[in] aValue Value to be formatted and inserted into the Log string stream 62 | * 63 | * @return Currents Log instance 64 | */ 65 | template 66 | Log& operator<< (const T& aValue) { 67 | if (nullptr != mpStream) { 68 | *mpStream << aValue; 69 | } 70 | return (*this); 71 | } 72 | 73 | /** 74 | * @brief Destructor : output the Log string stream 75 | */ 76 | ~Log(void); 77 | 78 | /// @brief Severity Level of this Log 79 | inline Level getSeverity(void) const { 80 | return mSeverity; 81 | } 82 | 83 | /// @brief Timestamp of this Log 84 | inline const DateTime& getTime(void) const { 85 | return mTime; 86 | } 87 | 88 | /// @brief The underlying string stream 89 | inline const std::ostringstream& getStream(void) const { 90 | return *mpStream; 91 | } 92 | 93 | /** 94 | * @brief Convert a Level to its string representation 95 | * 96 | * @param[in] aLevel Log severity Level to convert 97 | * 98 | * @return Severity Level description 99 | */ 100 | static const char* toString(Log::Level aLevel); 101 | 102 | /** 103 | * @brief Convert a string representation of a Level to its corresponding value 104 | * 105 | * @param[in] apLevel Log severity string Level 106 | * 107 | * @return Severity Level value 108 | */ 109 | static Log::Level toLevel(const char* apLevel); 110 | 111 | private: 112 | /** 113 | * @brief Construct a RAII (private) log object for the Logger class 114 | * 115 | * @param[in] aLogger Reference to the parent Logger 116 | * @param[in] aSeverity Severity of this Log 117 | */ 118 | Log(const Logger& aLogger, Level aSeverity); 119 | 120 | /// @{ Non-copyable object 121 | Log(const Log&); 122 | void operator=(const Log&); 123 | /// @} 124 | 125 | private: 126 | const Logger& mLogger; ///< Reference to the parent Logger 127 | Level mSeverity; ///< Severity of this Log 128 | DateTime mTime; ///< Timestamp of the output 129 | std::ostringstream* mpStream; ///< The underlying string stream 130 | }; 131 | 132 | 133 | } // namespace Log 134 | 135 | -------------------------------------------------------------------------------- /include/LoggerCpp/Logger.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Logger.h 3 | * @ingroup LoggerCpp 4 | * @brief A simple thread-safe Logger class 5 | * 6 | * Copyright (c) 2013-2018 Sebastien Rombauts (sebastien.rombauts@gmail.com) 7 | * 8 | * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt 9 | * or copy at http://opensource.org/licenses/MIT) 10 | */ 11 | #pragma once 12 | 13 | #include 14 | #include 15 | 16 | #include 17 | 18 | 19 | /** 20 | * @brief LoggerC++ (LoggerCpp) is a simple, elegant and efficient C++ logger library. 21 | * @ingroup LoggerCpp 22 | */ 23 | namespace Log { 24 | 25 | 26 | /** 27 | * @brief A simple thread-safe logger class 28 | * @ingroup LoggerCpp 29 | * 30 | * Logger is designed to be easy to use, light (size of a shared_ptr) and efficient. 31 | * It can be used as a member variable, and will not consume much CPU 32 | * if the log severity is below the Logger current Log::Level. 33 | * 34 | * @note A Logger object is copyable without any limitations 35 | */ 36 | class Logger { 37 | friend class Log; 38 | 39 | public: 40 | /** 41 | * @brief Initialize a Logger utility object 42 | * 43 | * @param[in] apChannelName String to identify origin of Log output by this Logger 44 | */ 45 | explicit Logger(const char* apChannelName); 46 | /** 47 | * @brief Non virtual destructor 48 | */ 49 | ~Logger(void); 50 | 51 | // A Logger is copyable with its a default copy constructor and copy operator without any problem 52 | 53 | /// @{ Utility const method to produce Log objets, used to collect the stream to output 54 | Log debug(void) const; 55 | Log info(void) const; 56 | Log notice(void) const; 57 | Log warning(void) const; 58 | Log error(void) const; 59 | Log critic(void) const; 60 | /// @} 61 | 62 | /// @brief Name of the underlying Channel 63 | inline const std::string& getName(void) const { 64 | return mChannelPtr->getName(); 65 | } 66 | 67 | /// @brief Set the current output Log::Level of the underlying Channel 68 | inline void setLevel(Log::Level aLevel) { 69 | mChannelPtr->setLevel(aLevel); 70 | } 71 | 72 | /// @brief Current Log::Level of the underlying Channel 73 | inline Log::Level getLevel(void) const { 74 | return mChannelPtr->getLevel(); 75 | } 76 | 77 | private: 78 | /** 79 | * @brief Output the Log. Used only by the Log class destructor. 80 | * 81 | * @param[in] aLog The Log to output 82 | */ 83 | void output(const Log& aLog) const; 84 | 85 | private: 86 | Channel::Ptr mChannelPtr; ///< Shared pointer to the underlying Channel 87 | }; 88 | 89 | 90 | } // namespace Log 91 | 92 | -------------------------------------------------------------------------------- /include/LoggerCpp/LoggerCpp.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file LoggerCpp.h 3 | * @ingroup LoggerCpp 4 | * @brief LoggerC++ (LoggerCpp) is a simple, elegant and efficient C++ logger library. 5 | * 6 | * Include this main header file in your project to gain access to all functionality provided by the logger. 7 | * 8 | * Copyright (c) 2013-2018 Sebastien Rombauts (sebastien.rombauts@gmail.com) 9 | * 10 | * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt 11 | * or copy at http://opensource.org/licenses/MIT) 12 | */ 13 | /** 14 | * @defgroup LoggerCpp LoggerC++ 15 | * @brief LoggerC++ (LoggerCpp) is a simple, elegant and efficient C++ logger library. 16 | */ 17 | #pragma once 18 | 19 | 20 | // Include useful headers of LoggerC++ 21 | #include 22 | #include 23 | 24 | 25 | /** 26 | * @def LOGGERCPP_VERSION 27 | * @brief Srting version numbers for LoggerC++ 28 | * @ingroup LoggerCpp 29 | * 30 | * The LOGGERCPP_VERSION C preprocessor macro in the LoggerCpp.h header 31 | * evaluates to a string literal that is the LoggerC++ version in the 32 | * format "X.Y.Z" where X is the major version number 33 | * and Y is the minor version number and Z is the release number. 34 | */ 35 | #define LOGGERCPP_VERSION "0.2.0" 36 | /** 37 | * @def LOGGERCPP_VERSION_NUMBER 38 | * @brief Numeric version numbers for LoggerC++ 39 | * @ingroup LoggerCpp 40 | * 41 | * The LOGGERCPP_VERSION_NUMBER C preprocessor macro resolves to an integer 42 | * with the value (X*1000000 + Y*1000 + Z) where X, Y, and Z are the same 43 | * numbers used in [LOGGERCPP_VERSION]. 44 | */ 45 | #define LOGGERCPP_VERSION_NUMBER 0002000 46 | -------------------------------------------------------------------------------- /include/LoggerCpp/Manager.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Manager.h 3 | * @ingroup LoggerCpp 4 | * @brief The static class that manage the registered Channel and Output objects 5 | * 6 | * Copyright (c) 2013-2018 Sebastien Rombauts (sebastien.rombauts@gmail.com) 7 | * 8 | * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt 9 | * or copy at http://opensource.org/licenses/MIT) 10 | */ 11 | #pragma once 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | 19 | namespace Log { 20 | 21 | 22 | /** 23 | * @brief The static class that manage the registered channels and outputs 24 | * @ingroup LoggerCpp 25 | * 26 | * The Manager keeps a map of all the named Channel objects 27 | * and share them on demand by new Logger objects created with the same name. 28 | * 29 | * Thus the Manager is able to change the Log::Level of selected Channel object, 30 | * impacting all the Logger objects using it. 31 | * 32 | * The Manager also keeps a list of all configured Output object to output the Log objects. 33 | */ 34 | struct Manager { 35 | public: 36 | /** 37 | * @brief Create and configure the Output objects. 38 | * 39 | * @see setChannelConfig() 40 | * 41 | * @param[in] aConfigList List of Config for Output objects 42 | */ 43 | static void configure(const Config::Vector& aConfigList); 44 | 45 | /** 46 | * @brief Destroy the Output objects. 47 | * 48 | * Clear the Output list to release the ownership. 49 | */ 50 | static void terminate(void); 51 | 52 | /** 53 | * @brief Return the Channel corresponding to the provided name 54 | * 55 | * Create a new Channel or get the existing one. 56 | * 57 | * @param[in] apChannelName String to identify the underlying Channel of a Logger 58 | * 59 | * @return Pointer to the corresponding Channel (never nullptr) 60 | */ 61 | static Channel::Ptr get(const char* apChannelName); 62 | 63 | /** 64 | * @brief Output the Log to all the active Output objects. 65 | * 66 | * Dispatch the Log to OutputConsole/OutputFile/OutputVS/OutputMemory... 67 | * 68 | * @param[in] aChannelPtr The underlying Channel of the Log 69 | * @param[in] aLog The Log to output 70 | */ 71 | static void output(const Channel::Ptr& aChannelPtr, const Log& aLog); 72 | 73 | /** 74 | * @brief Set the default output Log::Level of any new Channel 75 | */ 76 | static inline void setDefaultLevel(Log::Level aLevel) { 77 | mDefaultLevel = aLevel; 78 | } 79 | 80 | /** 81 | * @brief Serialize the current Log::Level of Channel objects and return them as a Config instance 82 | */ 83 | static Config::Ptr getChannelConfig(void); 84 | 85 | /** 86 | * @brief Set the Log::Level of Channel objects from the provided Config instance 87 | */ 88 | static void setChannelConfig(const Config::Ptr& aConfigPtr); 89 | 90 | private: 91 | static Channel::Map mChannelMap; ///< Map of shared pointer of Channel objects 92 | static Output::Vector mOutputList; ///< List of Output objects 93 | static Log::Level mDefaultLevel; ///< Default Log::Level of any new Channel 94 | }; 95 | 96 | 97 | } // namespace Log 98 | -------------------------------------------------------------------------------- /include/LoggerCpp/Output.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Output.h 3 | * @ingroup LoggerCpp 4 | * @brief Interface of an Output 5 | * 6 | * Copyright (c) 2013-2018 Sebastien Rombauts (sebastien.rombauts@gmail.com) 7 | * 8 | * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt 9 | * or copy at http://opensource.org/licenses/MIT) 10 | */ 11 | #pragma once 12 | 13 | #include 14 | 15 | #include 16 | #include 17 | 18 | // The following includes "boost/shared_ptr.hpp" if LOGGER_USE_BOOST_SHARED_PTR is defined, 19 | // or (or ) when C++11 (or experimental C++0x) is available, 20 | // or a custom minimal shared_ptr implementation, 21 | // and imports the "shared_ptr" symbol inside the Log namespace (ie. Log::shared_ptr) 22 | #include 23 | 24 | 25 | namespace Log { 26 | 27 | 28 | // Forward declaration 29 | class Log; 30 | 31 | /** 32 | * @brief Interface of an Output 33 | * @ingroup LoggerCpp 34 | */ 35 | class Output { 36 | public: 37 | /// @brief Virtual destructor 38 | virtual ~Output() {} 39 | 40 | public: 41 | /// @brief Shared Pointer to an Output 42 | typedef shared_ptr Ptr; 43 | /// @brief List of Output objects 44 | typedef std::vector Vector; 45 | 46 | /** 47 | * @brief Output the Log 48 | * 49 | * @param[in] aChannelPtr The underlying Channel of the Log 50 | * @param[in] aLog The Log to output 51 | */ 52 | virtual void output(const Channel::Ptr& aChannelPtr, const Log& aLog) const = 0; 53 | 54 | /// @brief Return the type name of the Output object 55 | inline const char* name() const { 56 | return typeid(this).name(); 57 | } 58 | }; 59 | 60 | 61 | } // namespace Log 62 | -------------------------------------------------------------------------------- /include/LoggerCpp/OutputConsole.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file OutputConsole.h 3 | * @ingroup LoggerCpp 4 | * @brief Output to the standard console using fprintf() with stdout 5 | * 6 | * Copyright (c) 2013-2018 Sebastien Rombauts (sebastien.rombauts@gmail.com) 7 | * 8 | * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt 9 | * or copy at http://opensource.org/licenses/MIT) 10 | */ 11 | #pragma once 12 | 13 | #include 14 | #include 15 | 16 | 17 | namespace Log { 18 | 19 | 20 | /** 21 | * @brief Output to the standard console using fprintf() with stdout 22 | * @ingroup LoggerCpp 23 | */ 24 | class OutputConsole : public Output { 25 | public: 26 | /// @brief Constructor : no config 27 | explicit OutputConsole(const Config::Ptr& aConfigPtr); 28 | 29 | /// @brief Destructor 30 | virtual ~OutputConsole(); 31 | 32 | #ifdef _WIN32 33 | /** 34 | * @brief Convert a Level to a Win32 console color text attribute 35 | * 36 | * @param[in] aLevel Log severity Level to convert 37 | * 38 | * @return Win32 console color text attribute 39 | */ 40 | static unsigned short toWin32Attribute(Log::Level aLevel); 41 | #else // _WIN32 42 | /** 43 | * @brief Convert a Level to an ANSI escape color code 44 | * 45 | * @param[in] aLevel Log severity Level to convert 46 | * 47 | * @return ANSI escape code for console color output 48 | */ 49 | static unsigned int toEscapeCode(Log::Level aLevel); 50 | #endif // _WIN32 51 | 52 | /** 53 | * @brief Output the Log to the standard console using fprintf 54 | * 55 | * @param[in] aChannelPtr The underlying Channel of the Log 56 | * @param[in] aLog The Log to output 57 | */ 58 | virtual void output(const Channel::Ptr& aChannelPtr, const Log& aLog) const; 59 | }; 60 | 61 | 62 | } // namespace Log 63 | -------------------------------------------------------------------------------- /include/LoggerCpp/OutputDebug.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file OutputDebug.h 3 | * @ingroup LoggerCpp 4 | * @brief Output to the Visual Studio debugger using OutputDebugString() 5 | * 6 | * Copyright (c) 2013-2018 Sebastien Rombauts (sebastien.rombauts@gmail.com) 7 | * 8 | * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt 9 | * or copy at http://opensource.org/licenses/MIT) 10 | */ 11 | #pragma once 12 | 13 | #include 14 | #include 15 | 16 | 17 | namespace Log { 18 | 19 | 20 | /** 21 | * @brief Output to the Visual Studio debugger using OutputDebugString() 22 | * @ingroup LoggerCpp 23 | */ 24 | class OutputDebug : public Output { 25 | public: 26 | /// @brief Constructor : no config 27 | explicit OutputDebug(const Config::Ptr& aConfigPtr); 28 | 29 | /// @brief Destructor 30 | virtual ~OutputDebug(); 31 | 32 | /** 33 | * @brief Output the Log to the Visual Studio debugger using OutputDebugString() 34 | * 35 | * @param[in] aChannelPtr The underlying Channel of the Log 36 | * @param[in] aLog The Log to output 37 | */ 38 | virtual void output(const Channel::Ptr& aChannelPtr, const Log& aLog) const; 39 | }; 40 | 41 | 42 | } // namespace Log 43 | -------------------------------------------------------------------------------- /include/LoggerCpp/OutputFile.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file OutputFile.h 3 | * @ingroup LoggerCpp 4 | * @brief Output to the a file using fprintf 5 | * 6 | * Copyright (c) 2013-2018 Sebastien Rombauts (sebastien.rombauts@gmail.com) 7 | * 8 | * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt 9 | * or copy at http://opensource.org/licenses/MIT) 10 | */ 11 | #pragma once 12 | 13 | #include 14 | #include 15 | 16 | #include 17 | 18 | 19 | namespace Log { 20 | 21 | 22 | /** 23 | * @brief Output to the standard console using fprintf 24 | * @ingroup LoggerCpp 25 | */ 26 | class OutputFile : public Output { 27 | public: 28 | /** 29 | * @brief Constructor : open the output file 30 | * 31 | * @param[in] aConfigPtr Config the output file with "filename" 32 | */ 33 | explicit OutputFile(const Config::Ptr& aConfigPtr); 34 | 35 | /// @brief Destructor : close the file 36 | virtual ~OutputFile(); 37 | 38 | /** 39 | * @brief Output the Log to the standard console using fprintf 40 | * 41 | * @param[in] aChannelPtr The underlying Channel of the Log 42 | * @param[in] aLog The Log to output 43 | */ 44 | virtual void output(const Channel::Ptr& aChannelPtr, const Log& aLog) const; 45 | 46 | private: 47 | /// @brief Open the log file 48 | void open() const; 49 | /// @brief Close the log file 50 | void close() const; 51 | /// @brief Rotate the log file : close, remove, rename, open 52 | void rotate() const; 53 | 54 | private: 55 | mutable FILE* mpFile; ///< @brief File pointer (mutable to be modified in the const output method) 56 | mutable long mSize; ///< @brief Current size of the log file (mutable to be modified in the const output method) 57 | 58 | /** 59 | * @brief "max_startup_size" : Size of the file above which to create a new file instead of appending to it (at startup). 60 | * 61 | * Default (0) creates a new file at each startup (never append to an existing one). 62 | */ 63 | long mMaxStartupSize; 64 | 65 | /** 66 | * @brief "max_size" : Size of the file above which to create a new file instead of appending to it (at runtime). 67 | * 68 | * Default (1024*1024=1Mo) creates a new file each time the current one grow above 1Mo. 69 | */ 70 | long mMaxSize; 71 | 72 | /** 73 | * @brief "filename" : Name of the log file 74 | */ 75 | std::string mFilename; 76 | 77 | /** 78 | * @brief "filename_old" : Name of the log file renamed after max_size is reach 79 | */ 80 | std::string mFilenameOld; 81 | }; 82 | 83 | 84 | } // namespace Log 85 | -------------------------------------------------------------------------------- /include/LoggerCpp/OutputSyslog.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file OutputSyslog.h 3 | * @ingroup LoggerCpp 4 | * @brief Output to Unix syslog 5 | * @author andre 6 | * 7 | * Copyright (c) 2018 Sebastien Rombauts (sebastien.rombauts@gmail.com) 8 | * 9 | * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt 10 | * or copy at http://opensource.org/licenses/MIT) 11 | */ 12 | #pragma once 13 | 14 | #ifdef __unix__ 15 | 16 | #include 17 | #include 18 | 19 | #include 20 | 21 | 22 | namespace Log { 23 | 24 | 25 | /** 26 | * @brief Output to the unix system syslog. Buffering & flushing is done by syslog itself. 27 | * @ingroup LoggerCpp 28 | */ 29 | class OutputSyslog : public Output { 30 | public: 31 | /** 32 | * @brief Open the syslog file 33 | * 34 | * @param[in] aConfigPtr Config the output file with "filename" 35 | */ 36 | explicit OutputSyslog(const Config::Ptr& aConfigPtr); 37 | 38 | /// @brief Destructor : close the syslog file 39 | virtual ~OutputSyslog(); 40 | 41 | /** 42 | * @brief Output the Log to the syslog 43 | * 44 | * @param[in] aChannelPtr The underlying Channel of the Log 45 | * @param[in] aLog The Log to output 46 | */ 47 | virtual void output(const Channel::Ptr& aChannelPtr, const Log& aLog) const; 48 | 49 | private: 50 | /** 51 | * @brief "name" : Name (prefix) of the entry in syslog. 52 | */ 53 | std::string mLogname; 54 | }; 55 | 56 | 57 | } // namespace Log 58 | 59 | #endif // __unix__ 60 | -------------------------------------------------------------------------------- /include/LoggerCpp/Utils.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Utils.h 3 | * @ingroup Utils 4 | * @brief Shared utility macros and functions. 5 | * 6 | * Copyright (c) 2013-2018 Sebastien Rombauts (sebastien.rombauts@gmail.com) 7 | * 8 | * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt 9 | * or copy at http://opensource.org/licenses/MIT) 10 | */ 11 | /** 12 | * @defgroup Utils Utils 13 | * @brief Shared utilities. 14 | */ 15 | #pragma once 16 | 17 | /** 18 | * @brief Shared utilities. 19 | * @ingroup Utils Utils 20 | */ 21 | namespace Utils { 22 | } // namespace Utils 23 | 24 | #include 25 | 26 | /** 27 | * @brief A macro to disallow the copy constructor and operator= functions. 28 | * 29 | * This should be used in the private: declarations for a class 30 | * 31 | * @param[in] TypeName Class name to protect 32 | */ 33 | #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ 34 | TypeName(const TypeName&); \ 35 | void operator=(const TypeName&) 36 | 37 | #ifdef _MSC_VER 38 | #if _MSC_VER < 1600 39 | /// A macro to enable the use of the nullptr keyword (NULL on older MSVC compilers, as they do not accept "nullptr_t") 40 | #ifndef nullptr 41 | #define nullptr NULL 42 | #endif // nullptr 43 | #endif // _MSC_VER < 1600 44 | #else // _MSC_VER 45 | #if (__cplusplus < 201103L) && !defined(__GXX_EXPERIMENTAL_CXX0X__) // before C++11 on GCC4.7 and Visual Studio 2010 46 | #ifndef HAVE_NULLPTR 47 | #define HAVE_NULLPTR ///< A macro to avoid double definition of nullptr 48 | /** 49 | * @brief nullptr_t is the type of the null pointer literal, nullptr. 50 | */ 51 | class nullptr_t { 52 | public: 53 | template 54 | inline operator T* () const { ///< convertible to any type of null non-member pointer... 55 | return 0; 56 | } 57 | 58 | template 59 | inline operator T C::* () const { ///< convertible to any type of null member pointer... 60 | return 0; 61 | } 62 | 63 | private: 64 | void operator&() const; ///< Can't take address of nullptr NOLINT 65 | }; 66 | 67 | /** 68 | * @brief Better way to enable nullptr on older GCC/Clang compilers 69 | */ 70 | const nullptr_t nullptr = {}; 71 | #endif // HAVE_NULLPTR 72 | #endif // (__cplusplus < 201103L) && !defined(__GXX_EXPERIMENTAL_CXX0X__) 73 | #endif // _MSC_VER 74 | 75 | // A macro for snprintf support in Visual Studio 76 | #if _MSC_VER && _MSC_VER < 1900 77 | #define snprintf _snprintf 78 | #endif 79 | -------------------------------------------------------------------------------- /include/LoggerCpp/shared_ptr.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file shared_ptr.hpp 3 | * @brief shared_ptr is a minimal implementation of smart pointer, a subset of the C++11 std::shared_ptr or boost::shared_ptr. 4 | * 5 | * This file includes "boost/shared_ptr.hpp" if LOGGER_USE_BOOST_SHARED_PTR is defined, 6 | * or (or ) when C++11 (or experimental C++0x) is available, 7 | * and imports the symbol "shared_ptr" inside the current namespace (ie. Log::shared_ptr). 8 | * If no std::shared_ptr is available, it defines a minimal shared_ptr implementation. 9 | * 10 | * Copyright (c) 2013-2018 Sebastien Rombauts (sebastien.rombauts@gmail.com) 11 | * 12 | * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt 13 | * or copy at http://opensource.org/licenses/MIT) 14 | */ 15 | #pragma once 16 | 17 | 18 | /// Compatibility with non-clang compilers. 19 | #ifndef __has_feature 20 | #define __has_feature(x) 0 21 | #endif 22 | 23 | // 24 | // Try to detect the better shared_ptr to use, and then imports the symbol in the current namespace 25 | // => if you include this "shared_ptr.hpp" file inside your own namespace you will 26 | // get a kind of universal easy to use "shared_ptr" type 27 | // 28 | #ifdef LOGGER_USE_BOOST_SHARED_PTR 29 | // Use Boost only if explicitly told 30 | #include 31 | namespace Log { 32 | using boost::shared_ptr; 33 | } // namespace Log 34 | // Detect whether the compiler supports C++11 shared_ptr or its TR1 pre-version. 35 | #elif (defined(__GNUC__) && \ 36 | (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2)) && \ 37 | defined(__GXX_EXPERIMENTAL_CXX0X__)) 38 | // 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) 39 | #include 40 | namespace Log { 41 | using std::shared_ptr; 42 | } // namespace Log 43 | #elif (defined(__GNUC__) && (__GNUC__ == 4) && defined(__GXX_EXPERIMENTAL_CXX0X__)) 44 | // GCC 4.0/4.1/4.2 have std::shared_ptr support when when called with -std=c++0x 45 | #include 46 | namespace Log { 47 | using std::tr1::shared_ptr; 48 | } // namespace Log 49 | #elif defined(__clang__) && __has_feature(cxx_nullptr) 50 | // Clang 2.9 and above ? 51 | #include 52 | namespace Log { 53 | using std::shared_ptr; 54 | } // namespace Log 55 | #elif defined(_MSC_VER) && (_MSC_VER >= 1600) 56 | // Visual Studio 2010 compile by default in C++11 mode 57 | #include 58 | namespace Log { 59 | using std::shared_ptr; 60 | } // namespace Log 61 | #elif defined(_MSC_VER) && (_MSC_VER >= 1500) 62 | // Visual Studio 2008 : beware, TR1 is provided with the Service Pack 1 only ! 63 | #include 64 | namespace Log { 65 | using std::tr1::shared_ptr; 66 | } // namespace Log 67 | #else 68 | 69 | 70 | #include // NULL 71 | #include // std::swap 72 | #include 73 | 74 | // can be replaced by other error mechanism 75 | #define SHARED_ASSERT(x) assert(x) 76 | 77 | namespace Log { 78 | 79 | /** 80 | * @brief minimal implementation of smart pointer, a subset of the C++11 std::shared_ptr or boost::shared_ptr. 81 | * 82 | * shared_ptr is a smart pointer retaining ownership of an object through a provided pointer, 83 | * and sharing this ownership with a reference counter. 84 | * It destroys the object when the last shared pointer pointing to it is destroyed or reset. 85 | */ 86 | template 87 | class shared_ptr 88 | { 89 | public: 90 | /// The type of the managed object, aliased as member type 91 | typedef T element_type; 92 | 93 | /// @brief Default constructor 94 | shared_ptr(void) throw() : // never throws 95 | px(NULL), 96 | pn(NULL) 97 | { 98 | } 99 | /// @brief Constructor with the provided pointer to manage 100 | explicit shared_ptr(T* p) : // may throw std::bad_alloc 101 | //px(p), would be unsafe as acquire() may throw, which would call release() in destructor 102 | pn(NULL) 103 | { 104 | acquire(p); // may throw std::bad_alloc 105 | } 106 | /// @brief Constructor to share ownership. Warning : to be used for pointer_cast only ! (does not manage two separate and pointers) 107 | template 108 | shared_ptr(const shared_ptr& ptr, T* p) : 109 | //px(p), would be unsafe as acquire() may throw, which would call release() in destructor 110 | pn(ptr.pn) 111 | { 112 | acquire(p); // may throw std::bad_alloc 113 | } 114 | /// @brief Copy constructor to convert from another pointer type 115 | template 116 | shared_ptr(const shared_ptr& ptr) throw() : // never throws (see comment below) 117 | //px(ptr.px), 118 | pn(ptr.pn) 119 | { 120 | SHARED_ASSERT((NULL == ptr.px) || (NULL != ptr.pn)); // must be cohérent : no allocation allowed in this path 121 | acquire(static_cast::element_type*>(ptr.px)); // will never throw std::bad_alloc 122 | } 123 | /// @brief Copy constructor (used by the copy-and-swap idiom) 124 | shared_ptr(const shared_ptr& ptr) throw() : // never throws (see comment below) 125 | //px(ptr.px), 126 | pn(ptr.pn) 127 | { 128 | SHARED_ASSERT((NULL == ptr.px) || (NULL != ptr.pn)); // must be cohérent : no allocation allowed in this path 129 | acquire(ptr.px); // will never throw std::bad_alloc 130 | } 131 | /// @brief Assignment operator using the copy-and-swap idiom (copy constructor and swap method) 132 | shared_ptr& operator=(shared_ptr ptr) throw() // never throws 133 | { 134 | swap(ptr); 135 | return *this; 136 | } 137 | /// @brief the destructor releases its ownership 138 | inline ~shared_ptr(void) throw() // never throws 139 | { 140 | release(); 141 | } 142 | /// @brief this reset releases its ownership 143 | inline void reset(void) throw() // never throws 144 | { 145 | release(); 146 | } 147 | /// @brief this reset release its ownership and re-acquire another one 148 | void reset(T* p) throw() // may throw std::bad_alloc 149 | { 150 | SHARED_ASSERT((NULL == p) || (px != p)); // auto-reset not allowed 151 | release(); 152 | acquire(p); // may throw std::bad_alloc 153 | } 154 | 155 | /// @brief Swap method for the copy-and-swap idiom (copy constructor and swap method) 156 | void swap(shared_ptr& lhs) throw() // never throws 157 | { 158 | // Would be nice to enable use of ustl::swap by define 159 | std::swap(px, lhs.px); 160 | std::swap(pn, lhs.pn); 161 | } 162 | 163 | // reference counter operations : 164 | inline operator bool() const throw() // never throws 165 | { 166 | return (0 < use_count()); 167 | } 168 | inline bool unique(void) const throw() // never throws 169 | { 170 | return (1 == use_count()); 171 | } 172 | long use_count(void) const throw() // never throws 173 | { 174 | long count = 0; 175 | if (NULL != pn) 176 | { 177 | count = *pn; 178 | } 179 | return count; 180 | } 181 | 182 | // underlying pointer operations : 183 | inline T& operator*() const throw() // never throws 184 | { 185 | SHARED_ASSERT(NULL != px); 186 | return *px; 187 | } 188 | inline T* operator->() const throw() // never throws 189 | { 190 | SHARED_ASSERT(NULL != px); 191 | return px; 192 | } 193 | inline T* get(void) const throw() // never throws 194 | { 195 | // no assert, car return NULL 196 | return px; 197 | } 198 | 199 | private: 200 | /// @brief acquire/share the ownership of the px pointer, initializing the reference counter 201 | void acquire(T* p) // may throw std::bad_alloc 202 | { 203 | if (NULL != p) 204 | { 205 | if (NULL == pn) 206 | { 207 | try 208 | { 209 | pn = new long(1); // may throw std::bad_alloc 210 | } 211 | catch (std::bad_alloc&) 212 | { 213 | delete p; 214 | throw; // rethrow the std::bad_alloc 215 | } 216 | } 217 | else 218 | { 219 | ++(*pn); 220 | } 221 | } 222 | // here it is safe to acquire the ownership of the provided raw pointer, where exception cannot be thrown any more 223 | px = p; 224 | } 225 | 226 | /// @brief release the ownership of the px pointer, destroying the object when appropriate 227 | void release(void) throw() // never throws 228 | { 229 | if (NULL != pn) 230 | { 231 | --(*pn); 232 | if (0 == *pn) 233 | { 234 | delete px; 235 | delete pn; 236 | } 237 | px = NULL; 238 | pn = NULL; 239 | } 240 | } 241 | 242 | private: 243 | // This allow pointer_cast functions to share the reference counter between different shared_ptr types 244 | template 245 | friend class shared_ptr; 246 | 247 | private: 248 | T* px; //!< Native pointer 249 | long* pn; //!< Reference counter 250 | }; 251 | 252 | 253 | // comparaison operators 254 | template inline bool operator==(const shared_ptr& l, const shared_ptr& r) throw() // never throws 255 | { 256 | return (l.get() == r.get()); 257 | } 258 | template inline bool operator!=(const shared_ptr& l, const shared_ptr& r) throw() // never throws 259 | { 260 | return (l.get() != r.get()); 261 | } 262 | template inline bool operator<=(const shared_ptr& l, const shared_ptr& r) throw() // never throws 263 | { 264 | return (l.get() <= r.get()); 265 | } 266 | template inline bool operator<(const shared_ptr& l, const shared_ptr& r) throw() // never throws 267 | { 268 | return (l.get() < r.get()); 269 | } 270 | template inline bool operator>=(const shared_ptr& l, const shared_ptr& r) throw() // never throws 271 | { 272 | return (l.get() >= r.get()); 273 | } 274 | template inline bool operator>(const shared_ptr& l, const shared_ptr& r) throw() // never throws 275 | { 276 | return (l.get() > r.get()); 277 | } 278 | 279 | 280 | 281 | // static cast of shared_ptr 282 | template 283 | shared_ptr static_pointer_cast(const shared_ptr& ptr) // never throws 284 | { 285 | return shared_ptr(ptr, static_cast::element_type*>(ptr.get())); 286 | } 287 | 288 | // dynamic cast of shared_ptr 289 | template 290 | shared_ptr dynamic_pointer_cast(const shared_ptr& ptr) // never throws 291 | { 292 | T* p = dynamic_cast::element_type*>(ptr.get()); 293 | if (NULL != p) 294 | { 295 | return shared_ptr(ptr, p); 296 | } 297 | else 298 | { 299 | return shared_ptr(); 300 | } 301 | } 302 | 303 | } // namespace Log 304 | 305 | #endif 306 | -------------------------------------------------------------------------------- /src/Config.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Config.cpp 3 | * @ingroup LoggerCpp 4 | * @brief Configuration for an Output object 5 | * 6 | * Copyright (c) 2013-2018 Sebastien Rombauts (sebastien.rombauts@gmail.com) 7 | * 8 | * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt 9 | * or copy at http://opensource.org/licenses/MIT) 10 | */ 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | 17 | 18 | namespace Log { 19 | 20 | 21 | // Constructor 22 | Config::Config(const char* apName) : 23 | mName(apName) { 24 | } 25 | 26 | // Destructor 27 | Config::~Config(void) { 28 | } 29 | 30 | // Get a string value 31 | const char* Config::get(const char* apKey, const char* apDefaultValue) const { 32 | const char* pValue; 33 | Config::Values::const_iterator iValue = mValues.find(apKey); 34 | if (mValues.end() != iValue) { 35 | pValue = iValue->second.c_str(); 36 | } else { 37 | pValue = apDefaultValue; 38 | } 39 | return pValue; 40 | } 41 | 42 | // Get a string value 43 | long Config::get(const char* apKey, long aDefaultValue) const { 44 | long value; 45 | Config::Values::const_iterator iValue = mValues.find(apKey); 46 | if (mValues.end() != iValue) { 47 | value = atol(iValue->second.c_str()); 48 | } else { 49 | value = aDefaultValue; 50 | } 51 | return value; 52 | } 53 | 54 | // Create the Config for a new Output 55 | void Config::addOutput(Vector& aConfigList, const char* apOutputName) { 56 | Log::Config::Ptr configPtr(new Log::Config(apOutputName)); 57 | aConfigList.push_back(configPtr); 58 | } 59 | 60 | // Set an option for the last added Output 61 | void Config::setOption(Vector& aConfigList, const char* apKey, const char* apValue) { 62 | (*aConfigList.back()).setValue(apKey, apValue); 63 | } 64 | 65 | } // namespace Log 66 | -------------------------------------------------------------------------------- /src/DateTime.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file DateTime.cpp 3 | * @ingroup LoggerCpp 4 | * @brief Current time precise to the millisecond. 5 | * 6 | * Copyright (c) 2013-2018 Sebastien Rombauts (sebastien.rombauts@gmail.com) 7 | * 8 | * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt 9 | * or copy at http://opensource.org/licenses/MIT) 10 | */ 11 | 12 | #include 13 | #include 14 | 15 | #ifdef WIN32 16 | #include 17 | #else 18 | #include 19 | #include 20 | #endif 21 | 22 | namespace Log { 23 | 24 | 25 | /// Constructor 26 | DateTime::DateTime(void) : 27 | year(0), 28 | month(0), 29 | day(0), 30 | hour(0), 31 | minute(0), 32 | second(0), 33 | ms(0), 34 | us(0) { 35 | } 36 | 37 | 38 | /// Set to current time 39 | void DateTime::make(void) { 40 | #ifdef WIN32 41 | SYSTEMTIME now; 42 | GetLocalTime(&now); 43 | 44 | year = now.wYear; 45 | month = now.wMonth; 46 | day = now.wDay; 47 | hour = now.wHour; 48 | minute = now.wMinute; 49 | second = now.wSecond; 50 | ms = now.wMilliseconds; 51 | us = 0; 52 | #else 53 | struct timeval now; 54 | gettimeofday(&now, nullptr); 55 | struct tm* timeinfo = localtime(&now.tv_sec); 56 | 57 | year = timeinfo->tm_year + 1900; 58 | month = timeinfo->tm_mon + 1; 59 | day = timeinfo->tm_mday; 60 | hour = timeinfo->tm_hour; 61 | minute = timeinfo->tm_min; 62 | second = timeinfo->tm_sec; 63 | ms = static_cast(now.tv_usec / 1000); 64 | us = static_cast(now.tv_usec % 1000); 65 | #endif 66 | } 67 | 68 | 69 | } // namespace Log 70 | -------------------------------------------------------------------------------- /src/Log.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Log.cpp 3 | * @ingroup LoggerCpp 4 | * @brief A RAII (private) log object constructed by the Logger class 5 | * 6 | * Copyright (c) 2013-2018 Sebastien Rombauts (sebastien.rombauts@gmail.com) 7 | * 8 | * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt 9 | * or copy at http://opensource.org/licenses/MIT) 10 | */ 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | 17 | 18 | namespace Log { 19 | 20 | 21 | // Construct a RAII (private) log object for the Logger class 22 | Log::Log(const Logger& aLogger, Level aSeverity) : 23 | mLogger(aLogger), 24 | mSeverity(aSeverity), 25 | mpStream(nullptr) { 26 | // Construct a stream only if the severity of the Log is above its Logger Log::Level 27 | if (aSeverity >= aLogger.getLevel()) { 28 | mpStream = new(std::ostringstream); 29 | } 30 | } 31 | 32 | // Destructor : output the Log string stream 33 | Log::~Log(void) { 34 | if (nullptr != mpStream) { 35 | mTime.make(); 36 | mLogger.output(*this); 37 | 38 | delete mpStream; 39 | mpStream = nullptr; 40 | } 41 | } 42 | 43 | // Convert a Level to its string representation 44 | const char* Log::toString(Log::Level aLevel) { 45 | const char* pString = nullptr; 46 | 47 | switch (aLevel) { 48 | case Log::eDebug: pString = "DBUG"; break; 49 | case Log::eInfo: pString = "INFO"; break; 50 | case Log::eNotice: pString = "NOTE"; break; 51 | case Log::eWarning: pString = "WARN"; break; 52 | case Log::eError: pString = "EROR"; break; 53 | case Log::eCritic: pString = "CRIT"; break; 54 | default: pString = "????"; break; 55 | } 56 | 57 | return pString; 58 | } 59 | 60 | // Convert a string representation of a Level to its corresponding value 61 | Log::Level Log::toLevel(const char* apLevel) { 62 | Log::Level level; 63 | 64 | if (0 == strncmp(apLevel, "DBUG", 4)) level = Log::eDebug; 65 | else if (0 == strncmp(apLevel, "INFO", 4)) level = Log::eInfo; 66 | else if (0 == strncmp(apLevel, "NOTE", 4)) level = Log::eNotice; 67 | else if (0 == strncmp(apLevel, "WARN", 4)) level = Log::eWarning; 68 | else if (0 == strncmp(apLevel, "EROR", 4)) level = Log::eError; 69 | else /* (0 == strncmp(apLevel, "CRIT", 4)*/ level = Log::eCritic; // NOLINT(whitespace/newline) 70 | 71 | return level; 72 | } 73 | 74 | 75 | } // namespace Log 76 | -------------------------------------------------------------------------------- /src/Logger.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Logger.cpp 3 | * @ingroup LoggerCpp 4 | * @brief A simple thread-safe Logger class 5 | * 6 | * Copyright (c) 2013-2018 Sebastien Rombauts (sebastien.rombauts@gmail.com) 7 | * 8 | * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt 9 | * or copy at http://opensource.org/licenses/MIT) 10 | */ 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | 17 | 18 | namespace Log { 19 | 20 | 21 | // Initialize a Logger utility object 22 | Logger::Logger(const char* apChannelName) { 23 | assert(nullptr != apChannelName); 24 | 25 | mChannelPtr = Manager::get(apChannelName); 26 | 27 | assert(mChannelPtr); 28 | } 29 | 30 | // Non virtual destructor 31 | Logger::~Logger(void) { 32 | } 33 | 34 | // Utility const method to produce Log objets, used to collect the stream to output 35 | Log Logger::debug(void) const { 36 | return Log(*this, Log::eDebug); 37 | } 38 | Log Logger::info(void) const { 39 | return Log(*this, Log::eInfo); 40 | } 41 | Log Logger::notice(void) const { 42 | return Log(*this, Log::eNotice); 43 | } 44 | Log Logger::warning(void) const { 45 | return Log(*this, Log::eWarning); 46 | } 47 | Log Logger::error(void) const { 48 | return Log(*this, Log::eError); 49 | } 50 | Log Logger::critic(void) const { 51 | return Log(*this, Log::eCritic); 52 | } 53 | 54 | // To be used only by the Log class 55 | void Logger::output(const Log& aLog) const { 56 | Manager::output(mChannelPtr, aLog); 57 | } 58 | 59 | 60 | } // namespace Log 61 | 62 | -------------------------------------------------------------------------------- /src/Manager.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Manager.cpp 3 | * @ingroup LoggerCpp 4 | * @brief The static class that manage the registered channels and outputs 5 | * 6 | * Copyright (c) 2013-2018 Sebastien Rombauts (sebastien.rombauts@gmail.com) 7 | * 8 | * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt 9 | * or copy at http://opensource.org/licenses/MIT) 10 | */ 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | 18 | #ifdef __unix__ 19 | #include 20 | #endif 21 | #ifdef WIN32 22 | #include 23 | #endif 24 | 25 | #include 26 | #include 27 | 28 | 29 | namespace Log { 30 | 31 | 32 | Channel::Map Manager::mChannelMap; 33 | Output::Vector Manager::mOutputList; 34 | Log::Level Manager::mDefaultLevel = Log::eDebug; 35 | 36 | 37 | // Create and configure the Output objects. 38 | void Manager::configure(const Config::Vector& aConfigList) { 39 | // List of all Output class ; those names are in the form 40 | // - "class Log::OutputConsole" under Visual Studio 2010 41 | // - "N3Log13OutputConsoleE" under GCC 42 | std::string outputConsole = typeid(OutputConsole).name(); 43 | std::string outputFile = typeid(OutputFile).name(); 44 | #ifdef __unix__ 45 | std::string outputSyslog = typeid(OutputSyslog).name(); 46 | #endif 47 | #ifdef WIN32 48 | std::string outputDebug = typeid(OutputDebug).name(); 49 | #endif 50 | 51 | Config::Vector::const_iterator iConfig; 52 | for ( iConfig = aConfigList.begin(); 53 | iConfig != aConfigList.end(); 54 | ++iConfig) { 55 | Output::Ptr outputPtr; 56 | const std::string& configName = (*iConfig)->getName(); 57 | 58 | // Compare the provided Output name with the known class name 59 | if (std::string::npos != outputConsole.find(configName)) { 60 | outputPtr.reset(new OutputConsole((*iConfig))); 61 | } else if (std::string::npos != outputFile.find(configName)) { 62 | outputPtr.reset(new OutputFile((*iConfig))); 63 | #ifdef __unix__ 64 | } else if (std::string::npos != outputSyslog.find(configName)) { 65 | outputPtr.reset(new OutputSyslog((*iConfig))); 66 | #endif 67 | #ifdef WIN32 68 | } else if (std::string::npos != outputDebug.find(configName)) { 69 | outputPtr.reset(new OutputDebug((*iConfig))); 70 | #endif 71 | } else { 72 | LOGGER_THROW("Unknown Output name '" << configName << "'"); 73 | } 74 | mOutputList.push_back(outputPtr); 75 | } 76 | } 77 | 78 | // Destroy the Output objects. 79 | void Manager::terminate(void) { 80 | // This effectively destroys the Output objects 81 | mOutputList.clear(); 82 | } 83 | 84 | // Return the Channel corresponding to the provided name 85 | Channel::Ptr Manager::get(const char* apChannelName) { 86 | Channel::Ptr ChannelPtr; 87 | Channel::Map::iterator iChannelPtr = mChannelMap.find(apChannelName); 88 | 89 | if (mChannelMap.end() != iChannelPtr) { 90 | ChannelPtr = iChannelPtr->second; 91 | } else { 92 | /// @todo Add a basic thread-safety security (throw if multiple threads create Loggers) 93 | ChannelPtr.reset(new Channel(apChannelName, mDefaultLevel)); 94 | mChannelMap[apChannelName] = ChannelPtr; 95 | } 96 | 97 | return ChannelPtr; 98 | } 99 | 100 | // Output the Log to all the active Output objects. 101 | void Manager::output(const Channel::Ptr& aChannelPtr, const Log& aLog) { 102 | Output::Vector::iterator iOutputPtr; 103 | 104 | for ( iOutputPtr = mOutputList.begin(); 105 | iOutputPtr != mOutputList.end(); 106 | ++iOutputPtr) { 107 | (*iOutputPtr)->output(aChannelPtr, aLog); 108 | } 109 | } 110 | 111 | // Serialize the current Log::Level of Channel objects and return them as a Config instance 112 | Config::Ptr Manager::getChannelConfig(void) { 113 | Config::Ptr ConfigPtr(new Config("ChannelConfig")); 114 | 115 | Channel::Map::const_iterator iChannel; 116 | for (iChannel = mChannelMap.begin(); 117 | iChannel != mChannelMap.end(); 118 | ++iChannel) { 119 | ConfigPtr->setValue(iChannel->first.c_str(), Log::toString(iChannel->second->getLevel())); 120 | } 121 | 122 | return ConfigPtr; 123 | } 124 | 125 | // Set the Log::Level of Channel objects from the provided Config instance 126 | void Manager::setChannelConfig(const Config::Ptr& aConfigPtr) { 127 | const Config::Values& ConfigValues = aConfigPtr->getValues(); 128 | 129 | Config::Values::const_iterator iValue; 130 | for (iValue = ConfigValues.begin(); 131 | iValue != ConfigValues.end(); 132 | ++iValue) { 133 | Manager::get(iValue->first.c_str())->setLevel(Log::toLevel(iValue->second.c_str())); 134 | } 135 | } 136 | 137 | } // namespace Log 138 | 139 | -------------------------------------------------------------------------------- /src/OutputConsole.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file OutputConsole.cpp 3 | * @ingroup LoggerCpp 4 | * @brief Output to the standard console using fprintf() with stdout 5 | * 6 | * Copyright (c) 2013-2018 Sebastien Rombauts (sebastien.rombauts@gmail.com) 7 | * 8 | * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt 9 | * or copy at http://opensource.org/licenses/MIT) 10 | */ 11 | 12 | #include 13 | 14 | #include 15 | 16 | #ifdef _WIN32 17 | #include 18 | #endif 19 | 20 | namespace Log { 21 | 22 | 23 | // Constructor 24 | OutputConsole::OutputConsole(const Config::Ptr& aConfigPtr) { 25 | (void)aConfigPtr; 26 | } 27 | 28 | // Destructor 29 | OutputConsole::~OutputConsole() { 30 | } 31 | 32 | #ifdef _WIN32 33 | 34 | // Convert a Level to a Win32 console color text attribute 35 | unsigned short OutputConsole::toWin32Attribute(Log::Level aLevel) { 36 | unsigned short code; 37 | 38 | switch (aLevel) { 39 | case Log::eDebug : code = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; break; // white 40 | case Log::eInfo : code = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY; break; 41 | case Log::eNotice : code = FOREGROUND_GREEN; break; // green 42 | case Log::eWarning : code = FOREGROUND_RED | FOREGROUND_GREEN; break; // orange 43 | case Log::eError : code = FOREGROUND_RED; break; // red 44 | case Log::eCritic : code = FOREGROUND_RED | FOREGROUND_INTENSITY; break; // light red 45 | default : code = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; break; // white 46 | } 47 | 48 | return (code); 49 | } 50 | 51 | #else // _WIN32 52 | 53 | // Convert a Level to its ANSI escape color code 54 | unsigned int OutputConsole::toEscapeCode(Log::Level aLevel) { 55 | unsigned int code; 56 | 57 | switch (aLevel) { 58 | case Log::eDebug: code = 34; break; // 34=blue 59 | case Log::eInfo: code = 39; break; // 39=white 60 | case Log::eNotice: code = 32; break; // 32=green 61 | case Log::eWarning: code = 33; break; // 33=orange 62 | case Log::eError: code = 31; break; // 31=red 63 | case Log::eCritic: code = 95; break; // 95=magenta 64 | default: code = 39; break; // 39=white (reset to default) 65 | } 66 | 67 | return code; 68 | } 69 | 70 | #endif // _WIN32 71 | 72 | // Output the Log to the standard console using fprintf 73 | void OutputConsole::output(const Channel::Ptr& aChannelPtr, const Log& aLog) const { 74 | const DateTime& time = aLog.getTime(); 75 | 76 | // uses fprintf for atomic thread-safe operation 77 | #ifdef _WIN32 78 | SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), toWin32Attribute(aLog.getSeverity())); 79 | fprintf(stdout, "%.4u-%.2u-%.2u %.2u:%.2u:%.2u.%.3u %-12s %s %s\n", 80 | #else // _WIN32 81 | fprintf(stdout, "\x1B[%02um%.4u-%.2u-%.2u %.2u:%.2u:%.2u.%.3u %-12s %s %s\x1b[39m\n", 82 | toEscapeCode(aLog.getSeverity()), 83 | #endif // _WIN32 84 | time.year, time.month, time.day, 85 | time.hour, time.minute, time.second, time.ms, 86 | aChannelPtr->getName().c_str(), Log::toString(aLog.getSeverity()), (aLog.getStream()).str().c_str()); 87 | #ifdef _WIN32 88 | SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); 89 | #endif // _WIN32 90 | fflush(stdout); 91 | } 92 | 93 | 94 | } // namespace Log 95 | -------------------------------------------------------------------------------- /src/OutputDebug.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file OutputDebug.cpp 3 | * @ingroup LoggerCpp 4 | * @brief Output to the Visual Studio debugger using OutputDebugString() 5 | * 6 | * Copyright (c) 2013-2018 Sebastien Rombauts (sebastien.rombauts@gmail.com) 7 | * 8 | * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt 9 | * or copy at http://opensource.org/licenses/MIT) 10 | */ 11 | 12 | #ifdef WIN32 13 | 14 | #include 15 | 16 | #include 17 | 18 | #include 19 | 20 | 21 | namespace Log { 22 | 23 | 24 | // Constructor 25 | OutputDebug::OutputDebug(const Config::Ptr& aConfigPtr) { 26 | (void)aConfigPtr; 27 | } 28 | 29 | // Destructor 30 | OutputDebug::~OutputDebug() { 31 | } 32 | 33 | // Output the Log to the Visual Studio debugger using OutputDebugString() 34 | void OutputDebug::output(const Channel::Ptr& aChannelPtr, const Log& aLog) const { 35 | const DateTime& time = aLog.getTime(); 36 | char buffer[256]; 37 | 38 | // uses snprintf for atomic thread-safe operation 39 | _snprintf(buffer, sizeof(buffer), "%.4u-%.2u-%.2u %.2u:%.2u:%.2u.%.3u %-12s %s %s\n", 40 | time.year, time.month, time.day, 41 | time.hour, time.minute, time.second, time.ms, 42 | aChannelPtr->getName().c_str(), Log::toString(aLog.getSeverity()), (aLog.getStream()).str().c_str()); 43 | buffer[255] = '\0'; 44 | OutputDebugStringA(buffer); 45 | } 46 | 47 | 48 | } // namespace Log 49 | 50 | #endif // WIN32 51 | -------------------------------------------------------------------------------- /src/OutputFile.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file OutputFile.cpp 3 | * @ingroup LoggerCpp 4 | * @brief Output to the standard console using printf 5 | * 6 | * Copyright (c) 2013-2018 Sebastien Rombauts (sebastien.rombauts@gmail.com) 7 | * 8 | * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt 9 | * or copy at http://opensource.org/licenses/MIT) 10 | */ 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | 20 | namespace Log { 21 | 22 | 23 | // Open the output file 24 | OutputFile::OutputFile(const Config::Ptr& aConfigPtr) : 25 | mpFile(nullptr) { 26 | assert(aConfigPtr); 27 | 28 | mMaxStartupSize = aConfigPtr->get("max_startup_size", (long)0); 29 | mMaxSize = aConfigPtr->get("max_size", (long)1024*1024); 30 | mFilename = aConfigPtr->get("filename", "log.txt"); 31 | mFilenameOld = aConfigPtr->get("filename_old", "log.old.txt"); 32 | 33 | // Test the size of the existing log file, rename it and open a new one if needed 34 | struct stat statFile; 35 | int ret = stat(mFilename.c_str(), &statFile); 36 | if (0 == ret) { 37 | mSize = statFile.st_size; 38 | } 39 | 40 | if (mSize > mMaxStartupSize) { 41 | rotate(); 42 | } else { 43 | open(); 44 | } 45 | } 46 | 47 | // Close the file 48 | OutputFile::~OutputFile() { 49 | close(); 50 | } 51 | 52 | // Open the file 53 | void OutputFile::open() const { 54 | mpFile = fopen(mFilename.c_str(), "ab"); 55 | if (nullptr == mpFile) { 56 | LOGGER_THROW("file \"" << mFilename << "\" not opened"); 57 | } 58 | } 59 | 60 | // Close the file if it is opened 61 | void OutputFile::close() const { 62 | if (nullptr != mpFile) { 63 | fclose(mpFile); 64 | mpFile = nullptr; 65 | mSize = 0; 66 | } 67 | } 68 | 69 | // Rotate a file : close, remove, rename, open 70 | void OutputFile::rotate() const { 71 | close(); 72 | 73 | remove(mFilenameOld.c_str()); 74 | rename(mFilename.c_str(), mFilenameOld.c_str()); 75 | 76 | open(); 77 | } 78 | 79 | // Output the Log to the standard console using printf 80 | void OutputFile::output(const Channel::Ptr& aChannelPtr, const Log& aLog) const { 81 | const DateTime& time = aLog.getTime(); 82 | 83 | if (mSize > mMaxSize) { 84 | rotate(); 85 | } 86 | 87 | if (nullptr != mpFile) { 88 | // uses fprintf for atomic thread-safe operation 89 | int nbWritten = fprintf(mpFile, "%.4u-%.2u-%.2u %.2u:%.2u:%.2u.%.3u %-12s %s %s\n", 90 | time.year, time.month, time.day, 91 | time.hour, time.minute, time.second, time.ms, 92 | aChannelPtr->getName().c_str(), Log::toString(aLog.getSeverity()), 93 | (aLog.getStream()).str().c_str()); 94 | fflush(mpFile); 95 | 96 | mSize += nbWritten; 97 | } 98 | } 99 | 100 | 101 | } // namespace Log 102 | -------------------------------------------------------------------------------- /src/OutputSyslog.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file OutputSyslog.cpp 3 | * @ingroup LoggerCpp 4 | * @brief Output to Unix syslog 5 | * @author andre 6 | * 7 | * Copyright (c) 2018 Sebastien Rombauts (sebastien.rombauts@gmail.com) 8 | * 9 | * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt 10 | * or copy at http://opensource.org/licenses/MIT) 11 | */ 12 | 13 | #ifdef __unix__ 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | namespace Log { 20 | 21 | OutputSyslog::OutputSyslog(const Config::Ptr& aConfigPtr) { 22 | assert(aConfigPtr); 23 | 24 | mLogname = aConfigPtr->get("syslogname", "LoggerCpp"); 25 | openlog(mLogname.c_str(), LOG_CONS, LOG_USER); 26 | } 27 | 28 | OutputSyslog::~OutputSyslog() { 29 | closelog(); 30 | } 31 | 32 | 33 | // Output the Log to the standard console using printf 34 | void OutputSyslog::output(const Channel::Ptr& aChannelPtr, const Log& aLog) const { 35 | 36 | // Just in case you wondered. No time stamp is needed here. Syslog will take care of it. 37 | 38 | // Now transform internal severity to syslog severity 39 | int pri = LOG_DEBUG; 40 | switch (aLog.getSeverity()) { 41 | default: 42 | case Log::eDebug: pri = LOG_DEBUG; break; 43 | case Log::eInfo: pri = LOG_INFO; break; 44 | case Log::eNotice: pri = LOG_NOTICE; break; 45 | case Log::eWarning: pri = LOG_WARNING; break; 46 | case Log::eError: pri = LOG_ERR; break; 47 | case Log::eCritic: pri = LOG_CRIT; break; 48 | } 49 | 50 | // Now write it out to syslog 51 | syslog(pri, "%-12s %s %s\n", 52 | aChannelPtr->getName().c_str(), Log::toString(aLog.getSeverity()), 53 | (aLog.getStream()).str().c_str()); 54 | } 55 | 56 | 57 | } // namespace Log 58 | 59 | #endif // __unix__ 60 | --------------------------------------------------------------------------------