pax_global_header00006660000000000000000000000064147764262650014535gustar00rootroot0000000000000052 comment=14a104bde76bd27a24e1b4dec0c15f371e995539 dtklog-0.0.3/000077500000000000000000000000001477642626500130215ustar00rootroot00000000000000dtklog-0.0.3/.github/000077500000000000000000000000001477642626500143615ustar00rootroot00000000000000dtklog-0.0.3/.github/ISSUE_TEMPLATE/000077500000000000000000000000001477642626500165445ustar00rootroot00000000000000dtklog-0.0.3/.github/ISSUE_TEMPLATE/empty-issue.md000066400000000000000000000001301477642626500213440ustar00rootroot00000000000000--- name: Empty issue about: File a Empty issue title: '' labels: '' assignees: '' --- dtklog-0.0.3/.github/ISSUE_TEMPLATE/unit-test-report.md000066400000000000000000000002611477642626500223320ustar00rootroot00000000000000--- name: Unit test report about: File a unit test report. title: 'Test: [class name]' labels: '' assignees: '' --- Path: [class file path] Interface: [class interface name] dtklog-0.0.3/.github/workflows/000077500000000000000000000000001477642626500164165ustar00rootroot00000000000000dtklog-0.0.3/.github/workflows/call-auto-tag.yml000066400000000000000000000005171477642626500215760ustar00rootroot00000000000000name: auto tag on: pull_request_target: types: [opened, synchronize, closed] paths: - "debian/changelog" concurrency: group: ${{ github.workflow }}-pull/${{ github.event.number }} cancel-in-progress: true jobs: auto_tag: uses: linuxdeepin/.github/.github/workflows/auto-tag.yml@master secrets: inherit dtklog-0.0.3/.github/workflows/call-chatOps.yml000066400000000000000000000002421477642626500214510ustar00rootroot00000000000000name: chatOps on: issue_comment: types: [created] jobs: chatopt: uses: linuxdeepin/.github/.github/workflows/chatOps.yml@master secrets: inherit dtklog-0.0.3/.github/workflows/call-clacheck.yml000066400000000000000000000005251477642626500216110ustar00rootroot00000000000000name: Call CLA check on: issue_comment: types: [created] pull_request_target: types: [opened, closed, synchronize] concurrency: group: ${{ github.workflow }}-pull/${{ github.event.number }} cancel-in-progress: true jobs: clacheck: uses: linuxdeepin/.github/.github/workflows/cla-check.yml@master secrets: inherit dtklog-0.0.3/.github/workflows/call-commitlint.yml000066400000000000000000000003641477642626500222340ustar00rootroot00000000000000name: Call commitlint on: pull_request_target: concurrency: group: ${{ github.workflow }}-pull/${{ github.event.number }} cancel-in-progress: true jobs: check_job: uses: linuxdeepin/.github/.github/workflows/commitlint.yml@master dtklog-0.0.3/.github/workflows/call-deploy-dev-doc.yml000066400000000000000000000007401477642626500226660ustar00rootroot00000000000000name: deploy docs on: push: branches: ["master"] workflow_dispatch: inputs: tag: required: true type: string permissions: contents: read pages: write id-token: write # Allow one concurrent deployment concurrency: group: "pages" cancel-in-progress: true jobs: deploydocs: uses: linuxdeepin/.github/.github/workflows/deploy-dev-doc.yml@master with: ref: ${{ inputs.tag }} secrets: inherit dtklog-0.0.3/.github/workflows/call-doc-check.yml000066400000000000000000000004671477642626500217010ustar00rootroot00000000000000name: doxygen-check on: pull_request_target: paths-ignore: - ".github/workflows/**" concurrency: group: ${{ github.workflow }}-pull/${{ github.event.number }} cancel-in-progress: true jobs: check_job: uses: linuxdeepin/.github/.github/workflows/doc-check.yml@master secrets: inherit dtklog-0.0.3/.github/workflows/call-license-check.yml000066400000000000000000000005521477642626500225510ustar00rootroot00000000000000name: Call License and README Check on: pull_request_target: types: [opened, synchronize, reopened] permissions: pull-requests: write contents: read concurrency: group: ${{ github.workflow }}-pull/${{ github.event.number }} cancel-in-progress: true jobs: license-check: uses: linuxdeepin/.github/.github/workflows/license-check.yml@master dtklog-0.0.3/.github/workflows/cppcheck.yml000066400000000000000000000012651477642626500207250ustar00rootroot00000000000000name: cppcheck on: pull_request_target: paths-ignore: - ".github/workflows/**" concurrency: group: ${{ github.workflow }}-pull/${{ github.event.number }} cancel-in-progress: true jobs: cppchceck: name: cppcheck runs-on: ubuntu-latest steps: - run: export - uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha }} persist-credentials: false - uses: linuxdeepin/action-cppcheck@main with: github_token: ${{ secrets.GITHUB_TOKEN }} repository: ${{ github.repository }} pull_request_id: ${{ github.event.pull_request.number }} allow_approve: false dtklog-0.0.3/.gitignore000066400000000000000000000005751477642626500150200ustar00rootroot00000000000000# C++ objects and libs *.slo *.lo *.o *.a *.la *.lai *.so *.so.* *.dll *.dylib # Temporary files *~ # Qt-es moc_*.cpp qrc_*.cpp *-build-* # CMake and qmake .qmake.stash CMakeFiles/ CMakeCache.txt cmake_install.cmake Makefile Makefile.Debug Makefile.Release # Generated doxygen documentation doc/ # build build/ # IDE *.pro.user *.pro.user.* CMakeLists.txt.user .vscode dtklog-0.0.3/.reuse/000077500000000000000000000000001477642626500142225ustar00rootroot00000000000000dtklog-0.0.3/.reuse/dep5000066400000000000000000000022401477642626500150000ustar00rootroot00000000000000Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: dlog Upstream-Contact: UnionTech Software Technology Co., Ltd. <> Source: https://github.com/linuxdeepin/dlog # Sample paragraph, commented out: # # Files: src/* # Copyright: $YEAR $NAME <$CONTACT> # License: ... # ci Files: .github/* *.yml *.yaml .obs/* .syncexclude Copyright: None License: CC0-1.0 # git Files: .gitignore Copyright: None License: CC0-1.0 # config Files: *.toml *.conf *.json .clang-format Copyright: None License: CC0-1.0 # qt Files: *.pro *.pri *.qrc *.prf Copyright: None License: CC0-1.0 # cmake Files: *.cmake *CMakeLists.txt *.pc.in Copyright: None License: CC0-1.0 # debian Files: debian/* Copyright: None License: CC0-1.0 # Arch Files: archlinux/* Copyright: None License: CC0-1.0 # docs Files: *.dox *.md src/util/README.dpinyin tools/qdbusxml2cpp/README Copyright: UnionTech Software Technology Co., Ltd. License: CC-BY-4.0 # doxygen src Files: docs/src/* Copyright: None License: CC0-1.0 # interface Files: include/D* Copyright: None License: CC0-1.0 Files: src/* include/* Copyright: UnionTech Software Technology Co., Ltd. License: LGPL-2.1-or-later dtklog-0.0.3/CMakeLists.txt000066400000000000000000000103201477642626500155550ustar00rootroot00000000000000CMAKE_MINIMUM_REQUIRED(VERSION 3.13) SET(CMAKE_CXX_STANDARD 11) SET(CMAKE_CXX_STANDARD_REQUIRED ON) SET(CMAKE_AUTOMOC ON) SET (DLOG_VERSION "0.0.1" CACHE STRING "define project version") SET (BUILD_WITH_SYSTEMD OFF CACHE BOOL "Build with systemd") SET (BUILD_WITH_QT6 OFF CACHE BOOL "Build with Qt6") IF(BUILD_WITH_QT6) SET(QT_VERSION_MAJOR "6") SET(DTK_VERSION_MAJOR "6") ELSE() SET(QT_VERSION_MAJOR "5") ENDIF() SET (DLog "Dtk${DTK_VERSION_MAJOR}Log") PROJECT(${DLog} VERSION ${DLOG_VERSION} DESCRIPTION "Simple, convinient and thread safe logger for Qt-based C++ apps" LANGUAGES CXX ) INCLUDE(GNUInstallDirs) INCLUDE(CMakePackageConfigHelpers) # configure_package_config_file SET (INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}/dtk${QT_VERSION_MAJOR}/DLog") SET (LIBRARY_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}") SET (CONFIG_CMAKE_INSTALL_DIR "${LIBRARY_INSTALL_DIR}/cmake/${DLog}" CACHE STRING "Install dir for cmake config files") SET (MKSPECS_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/qt${QT_VERSION_MAJOR}/mkspecs/modules" CACHE STRING "Install dir for qt pri files") FIND_PACKAGE(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core) FIND_PACKAGE(spdlog REQUIRED) IF(BUILD_WITH_SYSTEMD) FIND_PACKAGE(PkgConfig REQUIRED) PKG_CHECK_MODULES(Systemd REQUIRED IMPORTED_TARGET libsystemd) ENDIF() ADD_DEFINITIONS(-DLIBDLOG_LIBRARY) INCLUDE_DIRECTORIES(BEFORE include) SET(sources src/Logger.cpp src/AbstractAppender.cpp src/AbstractStringAppender.cpp src/ConsoleAppender.cpp src/FileAppender.cpp src/RollingFileAppender.cpp src/dloghelper.cpp src/rollingfilesink_p.h ) SET(includes include/AbstractStringAppender.h include/AbstractAppender.h include/ConsoleAppender.h include/FileAppender.h include/RollingFileAppender.h include/dloggerdefs.h include/dloghelper.h include/Logger.h include/dlog_global.h ) # OutputDebugAppender is only for Windows systems IF(WIN32) SET(sources ${sources} src/OutputDebugAppender.cpp) SET(includes ${includes} include/OutputDebugAppender.h) ENDIF(WIN32) IF(BUILD_WITH_SYSTEMD) SET(sources ${sources} src/JournalAppender.cpp) SET(includes ${includes} include/JournalAppender.h) ENDIF(BUILD_WITH_SYSTEMD) SET(library_target dtk${DTK_VERSION_MAJOR}log) ADD_LIBRARY(${library_target} SHARED ${sources} ${includes}) TARGET_INCLUDE_DIRECTORIES(${library_target} PUBLIC "$" "$" ) TARGET_LINK_DIRECTORIES(${library_target} INTERFACE "$" "$" ) SET_TARGET_PROPERTIES(${library_target} PROPERTIES VERSION ${CMAKE_PROJECT_VERSION} SOVERSION ${CMAKE_PROJECT_VERSION_MAJOR} EXPORT_NAME Log ) TARGET_LINK_LIBRARIES(${library_target} PUBLIC Qt${QT_VERSION_MAJOR}::Core) TARGET_LINK_LIBRARIES(${library_target} PRIVATE Qt${QT_VERSION_MAJOR}::CorePrivate spdlog::spdlog ) IF(BUILD_WITH_SYSTEMD) ADD_DEFINITIONS(-DBUILD_WITH_SYSTEMD) TARGET_LINK_LIBRARIES(${library_target} PRIVATE PkgConfig::Systemd) ENDIF() INSTALL(TARGETS ${library_target} EXPORT ${DLog}Targets DESTINATION ${LIBRARY_INSTALL_DIR} ) INSTALL(EXPORT ${DLog}Targets FILE ${DLog}Targets.cmake NAMESPACE Dtk${DTK_VERSION_MAJOR}:: DESTINATION ${CONFIG_CMAKE_INSTALL_DIR} ) INSTALL(FILES ${includes} DESTINATION "${INCLUDE_INSTALL_DIR}") # pkgconfig files CONFIGURE_FILE(misc/dtklog.pc.in ${library_target}.pc @ONLY) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${library_target}.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") # qmake module file CONFIGURE_FILE(misc/qt_lib_dtklog.pri.in qt_lib_dtklog.pri @ONLY) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/qt_lib_dtklog.pri DESTINATION "${MKSPECS_INSTALL_DIR}") CONFIGURE_PACKAGE_CONFIG_FILE(misc/DLogConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/${DLog}Config.cmake INSTALL_DESTINATION ${CONFIG_CMAKE_INSTALL_DIR} ) WRITE_BASIC_PACKAGE_VERSION_FILE( "${CMAKE_CURRENT_BINARY_DIR}/${DLog}ConfigVersion.cmake" VERSION ${DLOG_VERSION} COMPATIBILITY SameMajorVersion ) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DLog}Config.cmake DESTINATION ${CONFIG_CMAKE_INSTALL_DIR}) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DLog}ConfigVersion.cmake DESTINATION ${CONFIG_CMAKE_INSTALL_DIR}) dtklog-0.0.3/LICENSE.LGPL000066400000000000000000000635041477642626500145730ustar00rootroot00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! dtklog-0.0.3/LICENSES/000077500000000000000000000000001477642626500142265ustar00rootroot00000000000000dtklog-0.0.3/LICENSES/CC-BY-4.0.txt000066400000000000000000000411771477642626500160750ustar00rootroot00000000000000Creative Commons Attribution 4.0 International Creative Commons Corporation (“Creative Commons”) is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an “as-is” basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible. Using Creative Commons Public Licenses Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses. Considerations for licensors: Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC-licensed material, or material used under an exception or limitation to copyright. More considerations for licensors. Considerations for the public: By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensor’s permission is not necessary for any reason–for example, because of any applicable exception or limitation to copyright–then that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described. Although not required by our licenses, you are encouraged to respect those requests where reasonable. More considerations for the public. Creative Commons Attribution 4.0 International Public License By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions. Section 1 – Definitions. a. Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image. b. Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License. c. Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. d. Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements. e. Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material. f. Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License. g. Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license. h. Licensor means the individual(s) or entity(ies) granting rights under this Public License. i. Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them. j. Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world. k. You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning. Section 2 – Scope. a. License grant. 1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to: A. reproduce and Share the Licensed Material, in whole or in part; and B. produce, reproduce, and Share Adapted Material. 2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions. 3. Term. The term of this Public License is specified in Section 6(a). 4. Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material. 5. Downstream recipients. A. Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License. B. No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material. 6. No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i). b. Other rights. 1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise. 2. Patent and trademark rights are not licensed under this Public License. 3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties. Section 3 – License Conditions. Your exercise of the Licensed Rights is expressly made subject to the following conditions. a. Attribution. 1. If You Share the Licensed Material (including in modified form), You must: A. retain the following if it is supplied by the Licensor with the Licensed Material: i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated); ii. a copyright notice; iii. a notice that refers to this Public License; iv. a notice that refers to the disclaimer of warranties; v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable; B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License. 2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information. 3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable. 4. If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License. Section 4 – Sui Generis Database Rights. Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material: a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database; b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database. For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights. Section 5 – Disclaimer of Warranties and Limitation of Liability. a. Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You. b. To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You. c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability. Section 6 – Term and Termination. a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically. b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates: 1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or 2. upon express reinstatement by the Licensor. c. For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License. d. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License. e. Sections 1, 5, 6, 7, and 8 survive termination of this Public License. Section 7 – Other Terms and Conditions. a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed. b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License. Section 8 – Interpretation. a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License. b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions. c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor. d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority. Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses. Creative Commons may be contacted at creativecommons.org. dtklog-0.0.3/LICENSES/CC0-1.0.txt000066400000000000000000000156101477642626500156330ustar00rootroot00000000000000Creative Commons Legal Code CC0 1.0 Universal CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER. Statement of Purpose The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner") of an original work of authorship and/or a database (each, a "Work"). Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works ("Commons") that the public can reliably and without fear of later claims of infringement build upon, modify, incorporate in other works, reuse and redistribute as freely as possible in any form whatsoever and for any purposes, including without limitation commercial purposes. These owners may contribute to the Commons to promote the ideal of a free culture and the further production of creative, cultural and scientific works, or to gain reputation or greater distribution for their Work in part through the use and efforts of others. For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the "Affirmer"), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights. 1. Copyright and Related Rights. A Work made available under CC0 may be protected by copyright and related or neighboring rights ("Copyright and Related Rights"). Copyright and Related Rights include, but are not limited to, the following: i. the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work; ii. moral rights retained by the original author(s) and/or performer(s); iii. publicity and privacy rights pertaining to a person's image or likeness depicted in a Work; iv. rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(a), below; v. rights protecting the extraction, dissemination, use and reuse of data in a Work; vi. database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and vii. other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof. 2. Waiver. To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer's Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer's heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer's express Statement of Purpose. 3. Public License Fallback. Should any part of the Waiver for any reason be judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent permitted taking into account Affirmer's express Statement of Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise Affirmer's Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "License"). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer's express Statement of Purpose. 4. Limitations and Disclaimers. a. No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document. b. Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning the Work, express, implied, statutory or otherwise, including without limitation warranties of title, merchantability, fitness for a particular purpose, non infringement, or the absence of latent or other defects, accuracy, or the present or absence of errors, whether or not discoverable, all to the greatest extent permissible under applicable law. c. Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work or any use thereof, including without limitation any person's Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work. d. Affirmer understands and acknowledges that Creative Commons is not a party to this document and has no duty or obligation with respect to this CC0 or use of the Work. dtklog-0.0.3/LICENSES/LGPL-2.1-or-later.txt000066400000000000000000000624621477642626500175600ustar00rootroot00000000000000GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. < signature of Ty Coon > , 1 April 1990 Ty Coon, President of Vice That's all there is to it! dtklog-0.0.3/README.md000066400000000000000000000017071477642626500143050ustar00rootroot00000000000000# DtkLog Simple, convinient and thread safe logger for Qt-based C++ apps ## Short example ```cpp #include #include #include #include DLOG_CORE_USE_NAMESPACE int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); auto consoleAppender = new ConsoleAppender; consoleAppender->setFormat("[%{type:-7}] <%{Function}> %{message}\n"); dlogger->registerAppender(consoleAppender); dInfo("Starting the application"); dWarning() << "Something went wrong." << "Result code is" << -1; return 0; } ``` ## Adding DtkLog to your project Add this repo as a git submodule to your project. Include it to your CMakeLists.txt file: ```cmake find_package(DtkLog REQUIRED) ... ... TARGET_LINK_LIBRARIES(${your_target} ... Dtk::Log) ``` Include `dloghelper.h` and one or several appenders of your choice: ```cpp #include #include ``` dtklog-0.0.3/README.zh_CN.md000066400000000000000000000016211477642626500153000ustar00rootroot00000000000000# DtkLog `DtkLog` 是基于 `Qt5` 的 `C++`` 应用的简单、便捷、线程安全日志库 ## 简单示例 ```cpp #include #include #include #include DLOG_CORE_USE_NAMESPACE int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); auto consoleAppender = new ConsoleAppender; consoleAppender->setFormat("[%{type:-7}] <%{Function}> %{message}\n"); dlogger->registerAppender(consoleAppender); dInfo("Starting the application"); dWarning() << "Something went wrong." << "Result code is" << -1; return 0; } ``` ## 项目中引入 DtkLog CMakeLists.txt 文件: ```cmake find_package(DtkLog REQUIRED) ... ... TARGET_LINK_LIBRARIES(${your_target} ... Dtk::Log) ``` 包含 `dloghelper.h` 然后根据需要的 appender 包含头文件: ```cpp #include #include ``` dtklog-0.0.3/archlinux/000077500000000000000000000000001477642626500150165ustar00rootroot00000000000000dtklog-0.0.3/archlinux/PKGBUILD000066400000000000000000000014711477642626500161450ustar00rootroot00000000000000pkgname=dtklog-git pkgver=0.0.1 pkgrel=1 sourcename=dtklog sourcetars=("$sourcename"_"$pkgver".tar.xz) sourcedir="$sourcename" pkgdesc='DTK log modules' arch=('x86_64' 'aarch64') url="https://github.com/linuxdeepin/dtklog" license=('LGPL2.1') depends=('libsystemd' 'spdlog') makedepends=('git' 'qt5-tools' 'ninja' 'cmake') conflicts=('dtklog') provides=('dtklog') groups=('deepin-git') source=("${sourcetars[@]}") sha512sums=('SKIP') build() { cd $sourcedir version=$(echo $pkgver | awk -F'[+_~-]' '{print $1}') cmake \ -GNinja \ -DCMAKE_INSTALL_LIBDIR=lib \ -DMKSPECS_INSTALL_DIR=lib/qt/mkspecs/modules \ -DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_WITH_SYSTEMD=ON \ -DDLOG_VERSION=$version ninja } package() { cd $sourcedir DESTDIR="$pkgdir" ninja install } dtklog-0.0.3/debian/000077500000000000000000000000001477642626500142435ustar00rootroot00000000000000dtklog-0.0.3/debian/changelog000066400000000000000000000006371477642626500161230ustar00rootroot00000000000000dtklog (0.0.3) unstable; urgency=medium * fix: resolve compilation issues on Qt 6.9 -- JiDe Zhang Fri, 12 Apr 2025 14:00:00 +0800 dtklog (0.0.2) unstable; urgency=medium * release 0.0.2 -- Mike Chen Thu, 05 Dec 2024 14:14:09 +0800 dtklog (0.0.1) unstable; urgency=medium * release 0.0.1 -- Mike Chen Fri, 05 Jul 2024 15:31:08 +0800 dtklog-0.0.3/debian/control000066400000000000000000000013341477642626500156470ustar00rootroot00000000000000Source: dtklog Section: libdevel Priority: optional Maintainer: Deepin Packages Builder Build-Depends: debhelper-compat ( =12), pkg-config, qtbase5-private-dev, cmake, libspdlog-dev, libsystemd-dev Standards-Version: 3.9.8 Package: libdtklog Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same Description: Simple, convinient and thread safe logger for Qt-based C++ apps. This package contains the shared libraries. Package: libdtklog-dev Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, libdtklog( =${binary:Version}) Description: Simple, convinient and thread safe logger for Qt-based C++ apps. This package contains the header files and static libraries of dlog dtklog-0.0.3/debian/copyright000066400000000000000000000017231477642626500162010ustar00rootroot00000000000000Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: dtklog Source: https://github.com/linuxdeepin/dtklog Files: * Copyright: 2024 Deepin Technology Co., Ltd. License: LGPL-2.1 This package is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the GNU Library Public License, version 2, hence the version number 2.1. . This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. . You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . On Debian systems, the complete text of the GNU Lesser General Public License version 3 can be found in "/usr/share/common-licenses/LGPL-2.1". dtklog-0.0.3/debian/libdtklog-dev.install000066400000000000000000000001411477642626500203560ustar00rootroot00000000000000usr/include usr/lib/*/lib*.so usr/lib/*/pkgconfig/*.pc usr/lib/*/qt5/* usr/lib/*/cmake/*/*.cmake dtklog-0.0.3/debian/libdtklog.install000066400000000000000000000000241477642626500176020ustar00rootroot00000000000000usr/lib/*/lib*.so.* dtklog-0.0.3/debian/rules000077500000000000000000000017701477642626500153300ustar00rootroot00000000000000#!/usr/bin/make -f DPKG_EXPORT_BUILDFLAGS = 1 include /usr/share/dpkg/default.mk export QT_SELECT = qt5 export DEB_CXXFLAGS_MAINT_APPEND = -Ofast DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) VERSION = $(DEB_VERSION_UPSTREAM) PACK_VER = $(shell echo $(VERSION) | awk -F'[+_~-]' '{print $$1}') # Calculate build version: # 5.6.8 -> 0; 5.6.8.7 -> 7; 5.6.8+u001 -> 1; 5.6.8.7+u001 -> 7; 5.6.8.0+u001 -> 0 BUILD_VER = $(shell echo $(VERSION) | awk -F'[+_~-]' '{print $$1}' | awk -F'.' '{print $$4}' | sed 's/[^0-9]//g' | awk '{print int($$1)}') ifeq ($(BUILD_VER), 0) ifeq ($(shell expr $(shell echo "$(VERSION)" | awk -F. '{print NF-1}') '<' 3), 1) BUILD_VER=$(shell echo $(VERSION) | awk -F'[+_~-]' '{print $$2}' | sed 's/[^0-9]//g' | awk '{print int($$1)}') endif endif %: dh $@ override_dh_auto_configure: dh_auto_configure -- -DDLOG_VERSION=$(PACK_VER) -DBUILD_WITH_SYSTEMD=ON override_dh_makeshlibs: dh_makeshlibs -V "libdtklog (>= $(shell echo $(VERSION) | cut -d '.' -f 1,2))" dtklog-0.0.3/debian/source/000077500000000000000000000000001477642626500155435ustar00rootroot00000000000000dtklog-0.0.3/debian/source/format000066400000000000000000000000151477642626500167520ustar00rootroot000000000000003.0 (native) dtklog-0.0.3/include/000077500000000000000000000000001477642626500144445ustar00rootroot00000000000000dtklog-0.0.3/include/AbstractAppender.h000066400000000000000000000027521477642626500200450ustar00rootroot00000000000000/* Copyright (c) 2010 Boris Moiseev (cyberbobs at gmail dot com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation and appearing in the file LICENSE.LGPL included in the packaging of this file. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ #ifndef ABSTRACTAPPENDER_H #define ABSTRACTAPPENDER_H #include "dlog_global.h" #include "Logger.h" #include DLOG_CORE_BEGIN_NAMESPACE class LIBDLOG_SHARED_EXPORT AbstractAppender { public: AbstractAppender(); virtual ~AbstractAppender(); Logger::LogLevel detailsLevel() const; void setDetailsLevel(Logger::LogLevel level); void setDetailsLevel(const QString &level); void write(const QDateTime &time, Logger::LogLevel level, const char *file, int line, const char *func, const QString &category, const QString &msg); protected: virtual void append(const QDateTime &time, Logger::LogLevel level, const char *file, int line, const char *func, const QString &category, const QString &msg) = 0; private: QMutex m_writeMutex; Logger::LogLevel m_detailsLevel; mutable QMutex m_detailsLevelMutex; }; DLOG_CORE_END_NAMESPACE #endif // ABSTRACTAPPENDER_H dtklog-0.0.3/include/AbstractStringAppender.h000066400000000000000000000031511477642626500212260ustar00rootroot00000000000000/* Copyright (c) 2010 Boris Moiseev (cyberbobs at gmail dot com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation and appearing in the file LICENSE.LGPL included in the packaging of this file. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ #ifndef ABSTRACTSTRINGAPPENDER_H #define ABSTRACTSTRINGAPPENDER_H #include "AbstractAppender.h" #include #include DLOG_CORE_BEGIN_NAMESPACE class LIBDLOG_SHARED_EXPORT AbstractStringAppender : public AbstractAppender { public: AbstractStringAppender(); virtual QString format() const; void setFormat(const QString &format); static QString stripFunctionName(const char *name); protected: QString formattedString(const QDateTime &time, Logger::LogLevel level, const char *file, int line, const char *func, const QString &category, const QString &msg) const; QString formattedString(const QDateTime &time, Logger::LogLevel level, const char *file, int line, const char *func, const QString &category, const QString &msg, bool withcolor) const; private: static QByteArray qCleanupFuncinfo(const char *); QString m_format; mutable QReadWriteLock m_formatLock; }; DLOG_CORE_END_NAMESPACE #endif // ABSTRACTSTRINGAPPENDER_H dtklog-0.0.3/include/ConsoleAppender.h000066400000000000000000000023101477642626500176720ustar00rootroot00000000000000/* Copyright (c) 2010 Boris Moiseev (cyberbobs at gmail dot com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation and appearing in the file LICENSE.LGPL included in the packaging of this file. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ #ifndef CONSOLEAPPENDER_H #define CONSOLEAPPENDER_H #include "dlog_global.h" #include "AbstractStringAppender.h" DLOG_CORE_BEGIN_NAMESPACE class LIBDLOG_SHARED_EXPORT ConsoleAppender : public AbstractStringAppender { public: ConsoleAppender(); virtual QString format() const; void ignoreEnvironmentPattern(bool ignore); protected: virtual void append(const QDateTime &time, Logger::LogLevel level, const char *file, int line, const char *func, const QString &category, const QString &msg); private: bool m_ignoreEnvPattern; }; DLOG_CORE_END_NAMESPACE #endif // CONSOLEAPPENDER_H dtklog-0.0.3/include/FileAppender.h000066400000000000000000000026321477642626500171560ustar00rootroot00000000000000/* Copyright (c) 2010 Boris Moiseev (cyberbobs at gmail dot com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation and appearing in the file LICENSE.LGPL included in the packaging of this file. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ #ifndef FILEAPPENDER_H #define FILEAPPENDER_H // Logger #include "dlog_global.h" #include "AbstractStringAppender.h" // Qt #include #include DLOG_CORE_BEGIN_NAMESPACE class LIBDLOG_SHARED_EXPORT FileAppender : public AbstractStringAppender { public: FileAppender(const QString &fileName = QString()); ~FileAppender(); QString fileName() const; void setFileName(const QString &s); qint64 size() const; protected: virtual void append(const QDateTime &time, Logger::LogLevel level, const char *file, int line, const char *func, const QString &category, const QString &msg); bool openFile(); void closeFile(); private: QFile m_logFile; QTextStream m_logStream; mutable QMutex m_logFileMutex; }; DLOG_CORE_END_NAMESPACE #endif // FILEAPPENDER_H dtklog-0.0.3/include/JournalAppender.h000066400000000000000000000016051477642626500177100ustar00rootroot00000000000000// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: LGPL-2.1-or-later #ifndef JOURNALAPPENDER_H #define JOURNALAPPENDER_H #include "dlog_global.h" #include "AbstractAppender.h" DLOG_CORE_BEGIN_NAMESPACE class LIBDLOG_SHARED_EXPORT JournalAppender : public AbstractAppender { public: JournalAppender() : AbstractAppender() { } ~JournalAppender() override = default; using JournalPriority = int; protected: virtual void append(const QDateTime &time, Logger::LogLevel level, const char *file, int line, const char *func, const QString &category, const QString &msg) override; private: bool m_ignoreEnvPattern; }; DLOG_CORE_END_NAMESPACE #endif // JOURNALAPPENDER_H dtklog-0.0.3/include/Logger.h000066400000000000000000000056051477642626500160420ustar00rootroot00000000000000/* Copyright (c) 2012 Boris Moiseev (cyberbobs at gmail dot com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation and appearing in the file LICENSE.LGPL included in the packaging of this file. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ #ifndef LOGGER_H #define LOGGER_H #include #include #include #include "dloggerdefs.h" DLOG_CORE_BEGIN_NAMESPACE class AbstractAppender; class LoggerPrivate; class LIBDLOG_SHARED_EXPORT Logger { Q_DISABLE_COPY(Logger) public: //!@~english the log levels enum LogLevel { Trace, //!<@~english Trace level. Can be used for mostly unneeded records used for internal code tracing. Debug, //!<@~english Debug level.for the debugging of the software. Info, //!<@~english Info level. Can be used for informational records, which may be interesting for not only developers. Warning, //!<@~english Warning. May be used to log some non-fatal warnings detected by your application. Error, //!<@~english May be used for a big problems making your application work wrong but not crashing. Fatal //!<@~english Fatal. Used for unrecoverable errors, crashes the application (abort) right after the log record is written. }; Logger(); Logger(const QString &defaultCategory); ~Logger(); static Logger *globalInstance(); static QString levelToString(LogLevel level); static LogLevel levelFromString(const QString &str); void registerAppender(AbstractAppender *appender); void registerCategoryAppender(const QString &category, AbstractAppender *appender); QT_DEPRECATED_X("no longer take effect") void logToGlobalInstance(const QString &category, bool logToGlobal = false); void setDefaultCategory(const QString &category); QString defaultCategory() const; void write(const QDateTime &time, LogLevel level, const char *file, int line, const char *func, const char *category, const QString &msg); void write(LogLevel level, const char *file, int line, const char *func, const char *category, const QString &msg); QDebug write(LogLevel level, const char *file, int line, const char *func, const char *category); void writeAssert(const char *file, int line, const char *func, const char *condition); private: void write(const QDateTime &time, LogLevel level, const char *file, int line, const char *func, const char *category, const QString &msg, bool fromLocalInstance); Q_DECLARE_PRIVATE(Logger) LoggerPrivate *d_ptr; }; DLOG_CORE_END_NAMESPACE #endif // LOGGER_H dtklog-0.0.3/include/OutputDebugAppender.h000066400000000000000000000021041477642626500205400ustar00rootroot00000000000000/* Copyright (c) 2010 Karl-Heinz Reichel (khreichel at googlemail dot com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation and appearing in the file LICENSE.LGPL included in the packaging of this file. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ #ifndef OUTPUTDEBUGAPPENDER_H #define OUTPUTDEBUGAPPENDER_H #include "dlog_global.h" #include "AbstractStringAppender.h" DLOG_CORE_BEGIN_NAMESPACE class LIBDLOG_SHARED_EXPORT OutputDebugAppender : public AbstractStringAppender { protected: virtual void append(const QDateTime &time, Logger::LogLevel level, const char *file, int line, const char *func, const QString &category, const QString &msg); }; DLOG_CORE_END_NAMESPACE #endif // OUTPUTDEBUGAPPENDER_H dtklog-0.0.3/include/RollingFileAppender.h000066400000000000000000000065431477642626500205120ustar00rootroot00000000000000/* This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation and appearing in the file LICENSE.LGPL included in the packaging of this file. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ /*! * \brief The RollingFileAppender class extends FileAppender so that the underlying file is rolled over at a user chosen frequency. * * The class is based on Log4Qt.DailyRollingFileAppender class (http://log4qt.sourceforge.net/) * and has the same date pattern format. * * For example, if the fileName is set to /foo/bar and the DatePattern set to the daily rollover ('.'yyyy-MM-dd'.log'), on 2014-02-16 at midnight, * the logging file /foo/bar.log will be copied to /foo/bar.2014-02-16.log and logging for 2014-02-17 will continue in /foo/bar * until it rolls over the next day. * * The logFilesLimit parameter is used to automatically delete the oldest log files in the directory during rollover * (so no more than logFilesLimit recent log files exist in the directory at any moment). * \sa setDatePattern(DatePattern), setLogFilesLimit(int) */ #ifndef ROLLINGFILEAPPENDER_H #define ROLLINGFILEAPPENDER_H #include #include "FileAppender.h" DLOG_CORE_BEGIN_NAMESPACE class LIBDLOG_SHARED_EXPORT RollingFileAppender : public FileAppender { public: /*! @~english The enum DatePattern defines constants for date patterns. \sa setDatePattern(DatePattern) */ enum DatePattern { MinutelyRollover = 0, /*!<@~english The minutely date pattern string is "'.'yyyy-MM-dd-hh-mm". */ HourlyRollover, /*!<@~english The hourly date pattern string is "yyyy-MM-dd-hh". */ HalfDailyRollover, /*!<@~english The half-daily date pattern string is "'.'yyyy-MM-dd-a". */ DailyRollover, /*!<@~english The daily date pattern string is "'.'yyyy-MM-dd". */ WeeklyRollover, /*!<@~english The weekly date pattern string is "'.'yyyy-ww". */ MonthlyRollover /*!<@~english The monthly date pattern string is "'.'yyyy-MM". */ }; RollingFileAppender(const QString &fileName = QString()); DatePattern datePattern() const; void setDatePattern(DatePattern datePattern); QT_DEPRECATED_X("use setDatePattern(DatePattern)") void setDatePattern(const QString &datePattern); QT_DEPRECATED_X("use datePattern(DatePattern)") QString datePatternString() const; void setLogFilesLimit(int limit); int logFilesLimit() const; void setLogSizeLimit(int limit); qint64 logSizeLimit() const; protected: virtual void append(const QDateTime &time, Logger::LogLevel level, const char *file, int line, const char *func, const QString &category, const QString &msg); private: void rollOver(); void computeRollOverTime(); void computeFrequency(); void removeOldFiles(); void setDatePatternString(const QString &datePatternString); QString m_datePatternString; DatePattern m_frequency; QDateTime m_rollOverTime; QString m_rollOverSuffix; int m_logFilesLimit; qint64 m_logSizeLimit; mutable QMutex m_rollingMutex; }; DLOG_CORE_END_NAMESPACE #endif // ROLLINGFILEAPPENDER_H dtklog-0.0.3/include/dlog_global.h000066400000000000000000000034351477642626500170670ustar00rootroot00000000000000// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: LGPL-2.1-or-later #ifndef DLOGGER_GLOBAL_H #define DLOGGER_GLOBAL_H #include #define DLOG_NAMESPACE Dtk #if !defined(DLOG_NAMESPACE) #define DLOG_BEGIN_NAMESPACE #define DLOG_END_NAMESPACE #define DLOG_USE_NAMESPACE #else #define DLOG_BEGIN_NAMESPACE \ namespace DLOG_NAMESPACE \ { #define DLOG_END_NAMESPACE } #define DLOG_USE_NAMESPACE using namespace DLOG_NAMESPACE; #endif #define DLOGCORE_NAMESPACE Core #define DLOG_CORE_NAMESPACE DLOG_NAMESPACE::DLOGCORE_NAMESPACE #if !defined(DLOGCORE_NAMESPACE) #define DLOG_CORE_BEGIN_NAMESPACE #define DLOG_CORE_END_NAMESPACE #define DLOG_CORE_USE_NAMESPACE #else #define DLOG_CORE_BEGIN_NAMESPACE \ namespace DLOG_NAMESPACE \ { \ namespace DLOGCORE_NAMESPACE \ { #define DLOG_CORE_END_NAMESPACE \ } \ } #define DLOG_CORE_USE_NAMESPACE using namespace DLOG_CORE_NAMESPACE; #endif #if defined(DLOG_STATIC_LIB) #define LIBDLOG_SHARED_EXPORT #else #if defined(LIBDLOG_LIBRARY) #define LIBDLOG_SHARED_EXPORT Q_DECL_EXPORT #else #define LIBDLOG_SHARED_EXPORT Q_DECL_IMPORT #endif #endif #ifdef DLOG_DEPRECATED_CHECK #define DLOG_DECL_DEPRECATED_X(text) Q_DECL_HIDDEN #define DLOG_DECL_DEPRECATED Q_DECL_HIDDEN #else #ifdef __GNUC__ #if __GNUC__ < 13 #define DLOG_DECL_DEPRECATED __attribute__((__deprecated__)) #define DLOG_DECL_DEPRECATED_X(text) __attribute__((__deprecated__(text))) #else #define DLOG_DECL_DEPRECATED Q_DECL_DEPRECATED #define DLOG_DECL_DEPRECATED_X Q_DECL_DEPRECATED_X #endif #else #define DLOG_DECL_DEPRECATED Q_DECL_DEPRECATED #define DLOG_DECL_DEPRECATED_X Q_DECL_DEPRECATED_X #endif #endif #endif // DLOGGER_GLOBAL_H dtklog-0.0.3/include/dloggerdefs.h000066400000000000000000000037371477642626500171140ustar00rootroot00000000000000// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: LGPL-2.1-or-later #ifndef DLOGGER_DEFINE_H #define DLOGGER_DEFINE_H #include "dlog_global.h" #include DLOG_CORE_BEGIN_NAMESPACE class Logger; class DLogHelper; LIBDLOG_SHARED_EXPORT Logger *loggerInstance(); #define dlogger loggerInstance() #define DLOG_CTX(category) QMessageLogContext(__FILE__, __LINE__, Q_FUNC_INFO, category) // include DLog or dloghelper.h #define dTrace DLogHelper(Logger::Trace, DLOG_CTX("default")).write #define dDebug DLogHelper(Logger::Debug, DLOG_CTX("default")).write #define dInfo DLogHelper(Logger::Info, DLOG_CTX("default")).write #define dWarning DLogHelper(Logger::Warning, DLOG_CTX("default")).write #define dError DLogHelper(Logger::Error, DLOG_CTX("default")).write #define dFatal DLogHelper(Logger::Fatal, DLOG_CTX("default")).write #define dCDebug(category) DLogHelper(Logger::Debug, DLOG_CTX(category)).write() #define dCInfo(category) DLogHelper(Logger::Info, DLOG_CTX(category)).write() #define dCWarning(category) DLogHelper(Logger::Warning, DLOG_CTX(category)).write() #define dCError(category) DLogHelper(Logger::Error, DLOG_CTX(category)).write() #define dCFatal(category) DLogHelper(Logger::Fatal, DLOG_CTX(category)).write() #define dTraceTime \ DLogHelper helper(Logger::Trace, DLOG_CTX("default")); \ helper.timing #define dDebugTime \ DLogHelper helper(Logger::Debug, DLOG_CTX("default")); \ helper.timing #define dInfoTime \ DLogHelper helper(Logger::Info, DLOG_CTX("default")); \ helper.timing #define dAssert(cond) ((!(cond)) ? loggerInstance()->writeAssert(__FILE__, __LINE__, Q_FUNC_INFO, #cond) : qt_noop()) #define dAssertX(cond, msg) ((!(cond)) ? loggerInstance()->writeAssert(__FILE__, __LINE__, Q_FUNC_INFO, msg) : qt_noop()) DLOG_CORE_END_NAMESPACE #endif // DLOGGER_DEFINE_H dtklog-0.0.3/include/dloghelper.h000066400000000000000000000016371477642626500167510ustar00rootroot00000000000000// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: LGPL-2.1-or-later #ifndef DLOGHELPER_H #define DLOGHELPER_H #include #include "Logger.h" #include #include DLOG_CORE_BEGIN_NAMESPACE class DLogHelperPrivate; class LIBDLOG_SHARED_EXPORT DLogHelper : public QObject { Q_DISABLE_COPY(DLogHelper) public: DLogHelper(Logger::LogLevel level, const QMessageLogContext &context, QObject *parent = nullptr); ~DLogHelper(); void write(const char *msg, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3); void write(const QString &msg); QDebug write(); void timing(const QString &msg, QObject *context = nullptr); static Logger::LogLevel levelFromQtMsgType(QtMsgType mt); static QtMsgType qtMsgTypeFromLogLevel(Logger::LogLevel lvl); Q_DECLARE_PRIVATE(DLogHelper) }; DLOG_CORE_END_NAMESPACE #endif // DLOGHELPER_H dtklog-0.0.3/misc/000077500000000000000000000000001477642626500137545ustar00rootroot00000000000000dtklog-0.0.3/misc/DLogConfig.cmake.in000066400000000000000000000006501477642626500173370ustar00rootroot00000000000000@PACKAGE_INIT@ if(UNIX AND NOT APPLE) set(LINUX TRUE) endif() include(CMakeFindDependencyMacro) include(${CMAKE_CURRENT_LIST_DIR}/@DLog@Targets.cmake) get_target_property(Dtk@DTK_VERSION_MAJOR@Log_INCLUDE_DIRS Dtk@DTK_VERSION_MAJOR@::Log INTERFACE_INCLUDE_DIRECTORIES) get_target_property(Dtk@DTK_VERSION_MAJOR@Log_LIBRARY_DIRS Dtk@DTK_VERSION_MAJOR@::Log INTERFACE_LINK_DIRECTORIES) check_required_components(@DLog@) dtklog-0.0.3/misc/dtklog.pc.in000066400000000000000000000004451477642626500161740ustar00rootroot00000000000000prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} libdir=${prefix}/@LIBRARY_INSTALL_DIR@ includedir=${prefix}/@INCLUDE_INSTALL_DIR@ Name: @library_target@ Description: @CMAKE_PROJECT_DESCRIPTION@ Version: @CMAKE_PROJECT_VERSION@ Libs: -L${libdir} -l@library_target@ Cflags: -I${includedir} dtklog-0.0.3/misc/qt_lib_dtklog.pri.in000066400000000000000000000007471477642626500177230ustar00rootroot00000000000000QT.dtklog.VERSION = @CMAKE_PROJECT_VERSION@ QT.dtklog.MAJOR_VERSION = @PROJECT_VERSION_MAJOR@ QT.dtklog.MINOR_VERSION = @PROJECT_VERSION_MINOR@ QT.dtklog.PATCH_VERSION = @PROJECT_VERSION_PATCH@ QT.dtklog.name = dtklog QT.dtklog.module = dtk@DTK_VERSION_MAJOR@log QT.dtklog.libs = @CMAKE_INSTALL_PREFIX@/@LIBRARY_INSTALL_DIR@ QT.dtklog.includes = @CMAKE_INSTALL_PREFIX@/@INCLUDE_INSTALL_DIR@ QT.dtklog.frameworks = QT.dtklog.depends = core QT.dtklog.module_config = v2 ltcg QT_MODULES += dtklog-0.0.3/src/000077500000000000000000000000001477642626500136105ustar00rootroot00000000000000dtklog-0.0.3/src/AbstractAppender.cpp000066400000000000000000000133451477642626500175440ustar00rootroot00000000000000/* Copyright (c) 2010 Boris Moiseev (cyberbobs at gmail dot com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation and appearing in the file LICENSE.LGPL included in the packaging of this file. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ #include "AbstractAppender.h" DLOG_CORE_BEGIN_NAMESPACE /*! @~english \class Dtk::Core::AbstractAppender \inmodule dtkcore \brief The AbstractAppender class provides an abstract base class for writing a log entries. The AbstractAppender class is the base interface class for all log appenders that could be used with Logger. AbstractAppender provides a common implementation for the thread safe, mutex-protected logging of application messages, such as ConsoleAppender, FileAppender or something else. AbstractAppender is abstract and can not be instantiated, but you can use any of its subclasses or create a custom log appender at your choice. Appenders are the logical devices that is aimed to be attached to Logger object by calling Logger::registerAppender(). On each log record call from the application Logger object sequentially calls write() function on all the appenders registered in it. You can subclass AbstractAppender to implement a logging target of any kind you like. It may be the external logging subsystem (for example, syslog in *nix), XML file, SQL database entries, D-Bus messages or anything else you can imagine. For the simple non-structured plain text logging (for example, to a plain text file or to the console output) you may like to subclass the AbstractStringAppender instead of AbstractAppender, which will give you a more convenient way to control the format of the log output. \sa AbstractStringAppender \sa Logger::registerAppender() */ /*! @~english \brief Constructs a AbstractAppender object. */ AbstractAppender::AbstractAppender() : m_detailsLevel(Logger::Debug) { } /*! @~english \brief Destructs the AbstractAppender object. */ AbstractAppender::~AbstractAppender() { } /*! @~english \brief Returns the current details level of appender. Log records with a log level lower than a current detailsLevel() will be silently ignored by appender and would not be sent to its append() function. It provides additional logging flexibility, allowing you to set the different severity levels for different types of logs. \note This function is thread safe. \return The log level. \sa setDetailsLevel() \sa Logger::LogLevel */ Logger::LogLevel AbstractAppender::detailsLevel() const { QMutexLocker locker(&m_detailsLevelMutex); return m_detailsLevel; } /*! @~english \brief Sets the current details level of appender. Default details \a level is Logger::Debug \note This function is thread safe. \sa detailsLevel() \sa Logger::LogLevel */ void Dtk::Core::AbstractAppender::setDetailsLevel(Logger::LogLevel level) { QMutexLocker locker(&m_detailsLevelMutex); m_detailsLevel = level; } /*! @~english \brief Sets the current details \a level of appender. This function is provided for convenience, it behaves like an above function. \sa detailsLevel() \sa Logger::LogLevel */ void AbstractAppender::setDetailsLevel(const QString &level) { setDetailsLevel(Logger::levelFromString(level)); } /*! @~english \brief Tries to write the log record to this logger. This is the function called by Logger object to write a log \a message to the appender. The \a time parameter indicates the time stamp. The \a level parameter describes the LogLevel. The \a file parameter is the current file name. The \a line parameter indicates the number of lines to output. The \a func parameter indicates the function name to output. The \a category parameter indicates the log category. The \a msg parameter indicates the output message. \note This function is thread safe. \sa Logger::write() \sa detailsLevel() */ void AbstractAppender::write(const QDateTime &time, Logger::LogLevel level, const char *file, int line, const char *func, const QString &category, const QString &msg) { if (level < detailsLevel()) return; QMutexLocker locker(&m_writeMutex); append(time, level, file, line, func, category, msg); } /*! @~english \fn virtual void AbstractAppender::append(const QDateTime &timeStamp, Logger::LogLevel level, const char *file, int line, const char *function, const QString &category, const QString &message) = 0 \brief Writes the log record to the logger instance This function is called every time when user tries to write a message to this AbstractAppender instance using the write() function. Write function works as proxy and transfers only the messages with log level more or equal to the current logLevel(). Overload this function when you are implementing a custom appender. The \a time parameter indicates the time stamp. The \a level parameter describes the LogLevel. The \a file parameter is the current file name. The \a line parameter indicates the number of lines to output. The \a func parameter indicates the function name to output. The \a category parameter indicates the log category. The \a msg parameter indicates the output message. \note This function is not needed to be thread safe because it is never called directly by Logger object. The write() function works as a proxy and protects this function from concurrent access. \sa Logger::write() */ DLOG_CORE_END_NAMESPACE dtklog-0.0.3/src/AbstractStringAppender.cpp000066400000000000000000000446501477642626500207360ustar00rootroot00000000000000/* Copyright (c) 2010 Boris Moiseev (cyberbobs at gmail dot com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation and appearing in the file LICENSE.LGPL included in the packaging of this file. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ #include "AbstractStringAppender.h" #include #include #include DLOG_CORE_BEGIN_NAMESPACE inline static QString formattedLevelWithColor(Logger::LogLevel level, QString &msg) { switch (level) { case Logger::Trace: return QString("\x1b[94m%1\x1b[0m").arg(msg); case Logger::Debug: return QString("\x1b[36m%1\x1b[0m").arg(msg); case Logger::Info: return QString("\x1b[32m%1\x1b[0m").arg(msg); case Logger::Warning: return QString("\x1b[33m%1\x1b[0m").arg(msg); case Logger::Error: return QString("\x1b[31m%1\x1b[0m").arg(msg); case Logger::Fatal: return QString("\x1b[35m%1\x1b[0m").arg(msg); default: break; } return msg; } /*! @~english \class Dtk::Core::AbstractStringAppender \inmodule dtkcore \brief The AbstractStringAppender class provides a convenient base for appenders working with plain text formatted logs. AbstractSringAppender is the simple extension of the AbstractAppender class providing the convenient way to create custom log appenders working with a plain text formatted log targets. It have the formattedString() protected function that formats the logging arguments according to a format set with setFormat(). This class can not be directly instantiated because it contains pure virtual function inherited from AbstractAppender class. For more detailed description of customizing the log output format see the documentation on the setFormat() function. */ const char formattingMarker = '%'; /*! @~english \brief Constructs a new string appender object. */ AbstractStringAppender::AbstractStringAppender() : m_format(QLatin1String("%{time}{yyyy-MM-ddTHH:mm:ss.zzz} [%{type:-7}] <%{function}> %{message}\n")) { } /*! @~english \brief Returns the current log format string. The default format is set to "%{time}{yyyy-MM-ddTHH:mm:ss.zzz} [%{type:-7}] <%{function}> %{message}\n". You can set a different log record format using the setFormat() function. \sa setFormat(const QString&) */ QString AbstractStringAppender::format() const { QReadLocker locker(&m_formatLock); return m_format; } /*! @~english \brief Sets the logging format for writing strings to the log target with this appender. The string format seems to be very common to those developers who have used a standard sprintf function. Log output format is a simple QString with the special markers (starting with % sign) which will be replaced with it's internal meaning when writing a log record. Controlling marker begins with the percent sign (%) which is followed by the command inside {} brackets (the command describes, what will be put to log record instead of marker). Optional field width argument may be specified right after the command (through the colon symbol before the closing bracket) Some commands requires an additional formatting argument (in the second {} brackets). Field width argument works almost identically to the QString::arg() fieldWidth argument (and uses it internally). For example, "%{type:-7}" will be replaced with the left padded debug level of the message ("Debug ") or something. For the more detailed description of it you may consider to look to the Qt Reference Documentation. Supported marker commands are: \list \li %{time} - timestamp. You may specify your custom timestamp \a format using the second {} brackets after the marker, \li timestamp \a format here will be similar to those used in QDateTime::toString() function. For example, \li "%{time}{dd-MM-yyyy, HH:mm}" may be replaced with "17-12-2010, 20:17" depending on current date and time. \li The default \a format used here is "HH:mm:ss.zzz". \li %{type} - Log level. Possible log levels are shown in the Logger::LogLevel enumerator. \li %{Type} - Uppercased log level. \li %{typeOne} - One letter log level. \li %{TypeOne} - One uppercase letter log level. \li %{File} - Full source file name (with path) of the file that requested log recording. Uses the __FILE__ preprocessor macro. \li %{file} - Short file name (with stripped path). \li %{line} - Line number in the source file. Uses the __LINE__ preprocessor macro. \li %{Function} - Name of function that called on of the LOG_* macros. Uses the Q_FUNC_INFO macro provided with Qt. \li %{function} - Similar to the %{Function}, but the function name is stripped using stripFunctionName \li %{message} - The log message sent by the caller. \li %{category} - The log category. \li %{appname} - Application name (returned by QCoreApplication::applicationName() function). \li %{pid} - Application pid (returned by QCoreApplication::applicationPid() function). \li %{threadid} - ID of current thread. \li %% - Convinient marker that is replaced with the single % mark. \endlist \note Format doesn't add '\\n' to the end of the \a format line. Please consider adding it manually. \sa format() \sa stripFunctionName() \sa Logger::LogLevel */ void AbstractStringAppender::setFormat(const QString &format) { QWriteLocker locker(&m_formatLock); m_format = format; } /*! @~english \brief Strips the long function signature (as added by Q_FUNC_INFO macro). The string processing drops the returning type, arguments and template parameters of function. It is definitely useful for enchancing the log output readability. The \a name parameter is the function name. \return stripped function name */ QString AbstractStringAppender::stripFunctionName(const char *name) { return QString::fromLatin1(qCleanupFuncinfo(name)); } // The function was backported from Qt5 sources (qlogging.h) QByteArray AbstractStringAppender::qCleanupFuncinfo(const char *name) { QByteArray info(name); // Strip the function info down to the base function name // note that this throws away the template definitions, // the parameter types (overloads) and any const/volatile qualifiers. if (info.isEmpty()) return info; int pos; // skip trailing [with XXX] for templates (gcc) pos = info.size() - 1; if (info.endsWith(']')) { while (--pos) { if (info.at(pos) == '[') info.truncate(pos); } } bool hasLambda = false; QRegularExpression lambdaRegex("::"); QRegularExpressionMatch match = lambdaRegex.match(QString::fromLatin1(info)); if (match.hasMatch()) { hasLambda = true; info.remove(match.capturedStart(), match.capturedLength()); } // operator names with '(', ')', '<', '>' in it static const char operator_call[] = "operator()"; static const char operator_lessThan[] = "operator<"; static const char operator_greaterThan[] = "operator>"; static const char operator_lessThanEqual[] = "operator<="; static const char operator_greaterThanEqual[] = "operator>="; // canonize operator names info.replace("operator ", "operator"); // remove argument list Q_FOREVER { int parencount = 0; pos = info.lastIndexOf(')'); if (pos == -1) { // Don't know how to parse this function name return info; } // find the beginning of the argument list --pos; ++parencount; while (pos && parencount) { if (info.at(pos) == ')') ++parencount; else if (info.at(pos) == '(') --parencount; --pos; } if (parencount != 0) return info; info.truncate(++pos); if (info.at(pos - 1) == ')') { if (info.indexOf(operator_call) == pos - (int)strlen(operator_call)) break; // this function returns a pointer to a function // and we matched the arguments of the return type's parameter list // try again info.remove(0, info.indexOf('(')); info.chop(1); continue; } else { break; } } if (hasLambda) info.append("::lambda"); // find the beginning of the function name int parencount = 0; int templatecount = 0; --pos; // make sure special characters in operator names are kept if (pos > -1) { switch (info.at(pos)) { case ')': if (info.indexOf(operator_call) == pos - (int)strlen(operator_call) + 1) pos -= 2; break; case '<': if (info.indexOf(operator_lessThan) == pos - (int)strlen(operator_lessThan) + 1) --pos; break; case '>': if (info.indexOf(operator_greaterThan) == pos - (int)strlen(operator_greaterThan) + 1) --pos; break; case '=': { int operatorLength = (int)strlen(operator_lessThanEqual); if (info.indexOf(operator_lessThanEqual) == pos - operatorLength + 1) pos -= 2; else if (info.indexOf(operator_greaterThanEqual) == pos - operatorLength + 1) pos -= 2; break; } default: break; } } while (pos > -1) { if (parencount < 0 || templatecount < 0) return info; char c = info.at(pos); if (c == ')') ++parencount; else if (c == '(') --parencount; else if (c == '>') ++templatecount; else if (c == '<') --templatecount; else if (c == ' ' && templatecount == 0 && parencount == 0) break; --pos; } info = info.mid(pos + 1); // remove trailing '*', '&' that are part of the return argument while ((info.at(0) == '*') || (info.at(0) == '&')) info = info.mid(1); // we have the full function name now. // clean up the templates while ((pos = info.lastIndexOf('>')) != -1) { if (!info.contains('<')) break; // find the matching close int end = pos; templatecount = 1; --pos; while (pos && templatecount) { const char c = info.at(pos); if (c == '>') ++templatecount; else if (c == '<') --templatecount; --pos; } ++pos; info.remove(pos, end - pos + 1); } return info; } QString AbstractStringAppender::formattedString(const QDateTime &time, Logger::LogLevel level, const char *file, int line, const char *func, const QString &category, const QString &msg) const { return formattedString(time, level, file, line, func, category, msg, false); } /*! @~english \brief Returns the string to record to the logging target, formatted according to the format(). \a time The time stamp. The \a level parameter describes the LogLevel, and the \a file parameter is the current file name, and the \a line parameter indicates the number of lines to output. The \a func parameter indicates the function name to output. The \a category parameter indicates the log category. The \a msg parameter indicates the output message. The \a withcolor parameter indicates wether to add color to output \sa format() \sa setFormat(const QString&) */ QString AbstractStringAppender::formattedString(const QDateTime &time, Logger::LogLevel level, const char *file, int line, const char *func, const QString &category, const QString &msg, bool withcolor) const { QString f = format(); // dtkcore无法正确解析Qt的日志格式,dtk默认的日志格式并未和Qt统一,解析方式需要兼容两种不同的格式。 if (f.contains(QLatin1String("time "))) f.replace(f.indexOf(' ', f.indexOf(QLatin1String("time")) + QLatin1String("time").size()), 1, QLatin1String("}{")); const int size = f.size(); QString result; int i = 0; while (i < f.size()) { QChar c = f.at(i); // We will silently ignore the broken % marker at the end of string if (c != QLatin1Char(formattingMarker) || (i + 2) >= size) { result.append(c); } else { i += 2; QChar currentChar = f.at(i); QString command; int fieldWidth = 0; if (currentChar.isLetter()) { command.append(currentChar); int j = 1; while ((i + j) < size && f.at(i + j).isLetter()) { command.append(f.at(i + j)); j++; } i += j; currentChar = f.at(i); // Check for the padding instruction if (currentChar == QLatin1Char(':')) { currentChar = f.at(++i); if (currentChar.isDigit() || currentChar.category() == QChar::Punctuation_Dash) { int j = 1; while ((i + j) < size && f.at(i + j).isDigit()) j++; fieldWidth = f.mid(i, j).toInt(); i += j; } } } // Log record chunk to insert instead of formatting instruction QString chunk; // Time stamp if (command == QLatin1String("time")) { if (f.at(i + 1) == QLatin1Char('{')) { int j = 1; while ((i + 2 + j) < size && f.at(i + 2 + j) != QLatin1Char('}')) j++; if ((i + 2 + j) < size) { chunk = time.toString(f.mid(i + 2, j)); i += j; i += 2; } } if (chunk.isNull()) chunk = time.toString(QLatin1String("HH:mm:ss.zzz")); } else if (command == QLatin1String("type")) { // Log level chunk = Logger::levelToString(level); if (withcolor) { chunk = formattedLevelWithColor(level, chunk); } } else if (command == QLatin1String("Type")) { // Uppercased log level chunk = Logger::levelToString(level).toUpper(); if (withcolor) { chunk = formattedLevelWithColor(level, chunk); } } else if (command == QLatin1String("typeOne")) { // One letter log level chunk = Logger::levelToString(level).left(1).toLower(); if (withcolor) { chunk = formattedLevelWithColor(level, chunk); } } else if (command == QLatin1String("TypeOne")) { // One uppercase letter log level chunk = Logger::levelToString(level).left(1).toUpper(); if (withcolor) { chunk = formattedLevelWithColor(level, chunk); } } else if (command == QLatin1String("File")) { // Filename chunk = QLatin1String(file); } else if (command == QLatin1String("file")) { // Filename without a path chunk = QString(QLatin1String(file)).section('/', -1); } else if (command == QLatin1String("line")) { // Source line number chunk = QString::number(line); } else if (command == QLatin1String("Function")) { // Function name, as returned by Q_FUNC_INFO chunk = QString::fromLatin1(func); } else if (command == QLatin1String("function")) { // Stripped function name chunk = stripFunctionName(func); } else if (command == QLatin1String("message")) { // Log message chunk = msg; } else if (command == QLatin1String("category")) { // Log message chunk = category; } else if (command == QLatin1String("pid")) { // Application pid chunk = QString::number(QCoreApplication::applicationPid()); } else if (command == QLatin1String("appname")) { // Application name chunk = QCoreApplication::applicationName(); } else if (command == QLatin1String("threadid")) { // Thread ID (duplicates Qt5 threadid debbuging way) chunk = QLatin1String("0x") + QString::number(qlonglong(QThread::currentThread()->currentThread()), 16); } else if (command == QString(formattingMarker)) { // We simply replace the double formatting marker (%) with one chunk = QLatin1Char(formattingMarker); } else { // Do not process any unknown commands chunk = QString(formattingMarker); chunk.append(command); } if (!chunk.isEmpty() && chunk != "0") { result.append(QString(QLatin1String("%1")).arg(chunk, fieldWidth)); } } ++i; } return result; } DLOG_CORE_END_NAMESPACE dtklog-0.0.3/src/ConsoleAppender.cpp000066400000000000000000000062131477642626500173770ustar00rootroot00000000000000/* Copyright (c) 2010 Boris Moiseev (cyberbobs at gmail dot com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation and appearing in the file LICENSE.LGPL included in the packaging of this file. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ // Local #include "ConsoleAppender.h" #include #include #include #include #include // STL #include extern "C" { #include } DLOG_CORE_BEGIN_NAMESPACE /*! @~english @class Dtk::Core::ConsoleAppender @ingroup dlog @brief ConsoleAppender is the simple appender that writes the log records to the std::cerr output stream. ConsoleAppender uses "[%{type:-7}] <%{function}> %{message}\n" as a default output format. It is similar to the AbstractStringAppender but doesn't show a time. You can modify ConsoleAppender output format without modifying your code by using \c QT_MESSAGE_PATTERN environment variable. If you need your application to ignore this environment variable you can call ConsoleAppender::ignoreEnvironmentPattern(true) */ ConsoleAppender::ConsoleAppender() : AbstractStringAppender(), m_ignoreEnvPattern(false) { if (!spdlog::get("console")) { auto clogger = spdlog::stdout_color_mt("console"); clogger->set_level(spdlog::level::level_enum(detailsLevel())); } } QString ConsoleAppender::format() const { const QString envPattern = QString::fromLocal8Bit(qgetenv("QT_MESSAGE_PATTERN")); return (m_ignoreEnvPattern || envPattern.isEmpty()) ? AbstractStringAppender::format() : (envPattern + "\n"); } void ConsoleAppender::ignoreEnvironmentPattern(bool ignore) { m_ignoreEnvPattern = ignore; } /*! @~english \brief Writes the log record to the std::cerr stream. \reimp The \a time parameter indicates the time stamp. The \a level parameter describes the LogLevel. The \a file parameter is the current file name. The \a line parameter indicates the number of lines to output. The \a func parameter indicates the function name to output. The \a category parameter indicates the log category. The \a msg parameter indicates the output message. \sa AbstractStringAppender::format() */ void ConsoleAppender::append(const QDateTime &time, Logger::LogLevel level, const char *file, int line, const char *func, const QString &category, const QString &msg) { auto clogger = spdlog::get("console"); if (Q_UNLIKELY(!clogger)) return; clogger->set_level(spdlog::level::level_enum(detailsLevel())); const auto &formatted = formattedString(time, level, file, line, func, category, msg, isatty(STDOUT_FILENO)); clogger->log(spdlog::level::level_enum(level), formatted.toStdString()); } DLOG_CORE_END_NAMESPACE dtklog-0.0.3/src/FileAppender.cpp000066400000000000000000000066751477642626500166700ustar00rootroot00000000000000/* Copyright (c) 2010 Boris Moiseev (cyberbobs at gmail dot com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation and appearing in the file LICENSE.LGPL included in the packaging of this file. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ #include "FileAppender.h" #include #include "rollingfilesink_p.h" #include DLOG_CORE_BEGIN_NAMESPACE std::string loggerName(const QFile &logFile) { return QFileInfo(logFile).fileName().toStdString(); } /*! @~english @class Dtk::Core::FileAppender @ingroup dtkcore @brief Simple appender that writes the log records to the plain text file. */ /*! @~english @brief Constructs the new file appender assigned to file with the given \a fileName. */ FileAppender::FileAppender(const QString &fileName) { setFileName(fileName); } FileAppender::~FileAppender() { closeFile(); } /*! @~english \brief Returns the name set by setFileName() or to the FileAppender constructor. \sa setFileName() */ QString FileAppender::fileName() const { QMutexLocker locker(&m_logFileMutex); return m_logFile.fileName(); } /*! \brief Sets the \a s name of the file. The name can have no path, a relative path, or an absolute path. \sa fileName() */ void FileAppender::setFileName(const QString &s) { QMutexLocker locker(&m_logFileMutex); if (s == m_logFile.fileName()) return; closeFile(); m_logFile.setFileName(s); if (!spdlog::get(loggerName(QFile(s)))) rolling_logger_mt(loggerName(QFile(s)), m_logFile.fileName().toStdString(), 1024 * 1024 * 20, 0); } qint64 FileAppender::size() const { QMutexLocker locker(&m_logFileMutex); if (auto *bs = get_sink(loggerName(m_logFile))) { return qint64(bs->filesize()); } return m_logFile.size(); } bool FileAppender::openFile() { auto fl = spdlog::get(loggerName(m_logFile)); return fl.get(); } /*! @~english \brief Write the log record to the file. \reimp The \a time parameter indicates the time stamp. The \a level parameter describes the LogLevel. The \a file parameter is the current file name. The \a line parameter indicates the number of lines to output. The \a func parameter indicates the func name to output. The \a category parameter indicates the log category. The \a msg parameter indicates the output message. \sa fileName() \sa AbstractStringAppender::format() */ void FileAppender::append(const QDateTime &time, Logger::LogLevel level, const char *file, int line, const char *func, const QString &category, const QString &msg) { if (!openFile()) return; auto fl = spdlog::get(loggerName(m_logFile)); if (Q_UNLIKELY(!fl)) return; fl->set_level(spdlog::level::level_enum(detailsLevel())); const auto &formatted = formattedString(time, level, file, line, func, category, msg); fl->log(spdlog::level::level_enum(level), formatted.toStdString()); fl->flush(); } void FileAppender::closeFile() { spdlog::drop(loggerName(m_logFile)); } DLOG_CORE_END_NAMESPACE dtklog-0.0.3/src/JournalAppender.cpp000066400000000000000000000035471477642626500174160ustar00rootroot00000000000000// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: LGPL-2.1-or-later #include "JournalAppender.h" #define SD_JOURNAL_SUPPRESS_LOCATION #include DLOG_CORE_BEGIN_NAMESPACE /** * @~english * @brief it can be used to send log to journal * @param time journal time * @param level log level * @param file * @param line Number of lines of code when writing to the log * @param func function name * @param category log category * @param msg log message */ void JournalAppender::append(const QDateTime &time, Logger::LogLevel level, const char *file, int line, const char *func, const QString &category, const QString &msg) { JournalPriority logLevel = LOG_INFO; switch (level) { case Logger::Debug: logLevel = LOG_DEBUG; break; case Logger::Info: logLevel = LOG_INFO; break; case Logger::Warning: logLevel = LOG_WARNING; break; case Logger::Error: logLevel = LOG_ERR; break; case Logger::Fatal: logLevel = LOG_CRIT; break; default: logLevel = LOG_INFO; break; } sd_journal_send("MESSAGE=%s", msg.toStdString().c_str(), "PRIORITY=%d", logLevel, "DTKPRIORITTY=%d", level, "CODE_FILE=%s", file, "CODE_LINE=%d", line, "CODE_FUNC=%s", func, "CODE_CATEGORY=%s", category.toStdString().c_str(), NULL); } DLOG_CORE_END_NAMESPACE dtklog-0.0.3/src/Logger.cpp000066400000000000000000000771561477642626500155530ustar00rootroot00000000000000/* Copyright (c) 2012 Boris Moiseev (cyberbobs at gmail dot com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation and appearing in the file LICENSE.LGPL included in the packaging of this file. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ // Local #include "Logger.h" #include "AbstractAppender.h" #include "AbstractStringAppender.h" #include #include #include #include #include #include #include #include DLOG_CORE_BEGIN_NAMESPACE /*! @~english \headerfile \inmodule dtkcore @brief A file containing the description of Logger class and and additional useful macros for logging. */ /*! @~english \macro Dtk::Core::dlogger \relates Dtk::Core::Logger \keyword Dtk::Core::dlogger @brief Macro returning the current instance of Logger object If you haven't created a local Logger object it returns the same value as the Logger::globalInstance() functions. This macro is a recommended way to get an access to the Logger instance used in current class. Example: \code ConsoleAppender* consoleAppender = new ConsoleAppender; dlogger->registerAppender(consoleAppender); \endcode @sa Dtk::Core::Logger::globalInstance() */ /*! @~english \macro Dtk::Core::dTrace \relates Dtk::Core::Logger \keyword Dtk::Core::dTrace @brief Writes the trace log record This macro is the convenient way to call Logger::write(). It uses the common preprocessor macros \c __FILE__, \c __LINE__ and the standard Qt \c Q_FUNC_INFO macros to automatically determine the needed parameters to call Logger::write(). @note This and other (dInfo() etc...) macros uses the variadic macro arguments to give convenient usage form for the different versions of Logger::write() (using the QString or const char *argument or returning the QDebug class instance). Not all compilers will support this. Please, consider reviewing your compiler documentation to ensure it support __VA_ARGS__ macro. @sa Dtk::Core::dInfo Dtk::Core::dDebug Dtk::Core::dWarning Dtk::Core::dError @sa Dtk::Core::Logger::LogLevel @sa Dtk::Core::Logger::write() */ /*! @~english \macro Dtk::Core::dDebug \relates Dtk::Core::Logger \keyword Dtk::Core::dDebug @brief Writes the debug log record This macro records the debug log record using the Logger::write() function. It works similar to the dTrace() macro. @sa Dtk::Core::dTrace Dtk::Core::dInfo Dtk::Core::dWarning Dtk::Core::dError @sa Dtk::Core::Logger::LogLevel @sa Dtk::Core::Logger::write() */ /*! @~english \macro Dtk::Core::dInfo \relates Dtk::Core::Logger \keyword Dtk::Core::dInfo @brief Writes the info log record This macro records the info log record using the Logger::write() function. It works similar to the dTrace() macro. @sa Dtk::Core::dTrace Dtk::Core::dDebug Dtk::Core::dWarning Dtk::Core::dError @sa Dtk::Core::Logger::LogLevel @sa Dtk::Core::Logger::write() */ /*! @~english \macro Dtk::Core::dWarning \relates Dtk::Core::Logger \keyword Dtk::Core::dWarning @brief Write the warning log record This macro records the warning log record using the Logger::write() function. It works similar to the dTrace() macro. @sa Dtk::Core::dTrace Dtk::Core::dInfo Dtk::Core::dDebug Dtk::Core::dError @sa Dtk::Core::Logger::LogLevel @sa Dtk::Core::Logger::write() */ /*! @~english \macro Dtk::Core::dError \relates Dtk::Core::Logger \keyword Dtk::Core::dError @brief Write the error log record This macro records the error log record using the Logger::write() function. It works similar to the dTrace() macro. @sa Dtk::Core::dTrace @sa Dtk::Core::Logger::LogLevel @sa Dtk::Core::Logger::write() */ /*! @~english \macro Dtk::Core::dFatal \relates Dtk::Core::Logger \keyword Dtk::Core::dFatal @brief Write the fatal log record This macro records the fatal log record using the Logger::write() function. It works similar to the dTrace() macro. @note Recording of the log record using the Logger::Fatal log level will lead to calling the STL abort() function, which will interrupt the running of your software and begin the writing of the core dump. @sa Dtk::Core::dTrace @sa Dtk::Core::Logger::LogLevel @sa Dtk::Core::Logger::write() */ /*! @~english \macro Dtk::Core::dCTrace(category) \relates Dtk::Core::Logger \keyword Dtk::Core::dCTrace() @brief Writes the trace log record to the specific category This macro is the similar to the dTrace() macro, but has a category parameter to write only to the category appenders (registered using Logger::registerCategoryAppender() method). @param[in] category category name string @sa Dtk::Core::dTrace @sa Dtk::Core::Logger::LogLevel @sa Dtk::Core::Logger::registerCategoryAppender() @sa Dtk::Core::Logger::write() @sa Dtk::Core::dCategory(), Dtk::Core::dGlobalCategory() */ /*! @~english \macro Dtk::Core::dCDebug \relates Dtk::Core::Logger \keyword Dtk::Core::dCDebug @brief Writes the debug log record to the specific category This macro records the debug log record using the Logger::write() function. It works similar to the dCTrace() macro. @sa Dtk::Core::dCTrace() */ /*! @~english \macro Dtk::Core::dCInfo \relates Dtk::Core::Logger \keyword Dtk::Core::dCInfo @brief Writes the info log record to the specific category This macro records the info log record using the Logger::write() function. It works similar to the dCTrace() macro. @sa Dtk::Core::dCTrace() */ /*! @~english \macro Dtk::Core::dCWarning \relates Dtk::Core::Logger \keyword Dtk::Core::dCWarning @brief Writes the warning log record to the specific category This macro records the warning log record using the Logger::write() function. It works similar to the dCTrace() macro. @sa Dtk::Core::dCTrace() */ /*! @~english \macro Dtk::Core::dCError \relates Dtk::Core::Logger \keyword Dtk::Core::dCError @brief Writes the error log record to the specific category This macro records the error log record using the Logger::write() function. It works similar to the dCTrace() macro. @sa Dtk::Core::dCTrace() */ /*! @~english \macro Dtk::Core::dCFatal \relates Dtk::Core::Logger \keyword Dtk::Core::dCFatal @brief Write the fatal log record to the specific category This macro records the fatal log record using the Logger::write() function. It works similar to the dCTrace() macro. @note Recording of the log record using the Logger::Fatal log level will lead to calling the STL abort() function, which will interrupt the running of your software and begin the writing of the core dump. @sa Dtk::Core::dCTrace() */ /*! @~english \macro Dtk::Core::dCategory(category) \relates Dtk::Core::Logger \keyword Dtk::Core::dCategory() @brief Create dlogger instance inside your custom class to log all messages to the specified \a category This macro is used to pass all log messages inside your custom class to the specific \a category. You must include this macro inside your class declaration (similarly to the Q_OBJECT macro). Internally, this macro redefines loggerInstance() function, creates the local Logger object inside your class and sets the default category to the specified parameter. Thus, any call to loggerInstance() (for example, inside dTrace() macro) will return the local Logger object, so any logging message will be directed to the default category. @note This macro does not register any appender to the newly created dlogger instance. You should register dlogger appenders manually, inside your class. Usage example: \code class CustomClass : public QObject { Q_OBJECT dCategory("custom_category") ... }; CustomClass::CustomClass(QObject* parent) : QObject(parent) { dlogger->registerAppender(new FileAppender("custom_category_log")); dTrace() << "Trace to the custom category log"; } \endcode @sa Dtk::Core::Logger::write() @sa Dtk::Core::dTrace() @sa Dtk::Core::Logger::registerCategoryAppender() @sa Dtk::Core::Logger::setDefaultCategory() */ /*! @~english \macro Dtk::Core::dGlobalCategory(category) \relates Dtk::Core::Logger \keyword Dtk::Core::dGlobalCategory() @brief Create dlogger instance inside your custom class to log all messages both to the specified \a category and to the global dlogger instance. This macro is similar to dCategory(), but also passes all log messages to the global dlogger instance appenders. It is equal to defining the local \a category dlogger using dCategory macro and calling: \code dlogger->logToGlobalInstance(dlogger->defaultCategory(), true); \endcode @sa Dtk::Core::dCategory @sa Dtk::Core::Logger::logToGlobalInstance() @sa Dtk::Core::Logger::defaultCategory() @sa Dtk::Core::Logger::registerCategoryAppender() @sa Dtk::Core::Logger::write() */ /*! @~english \macro Dtk::Core::dAssert \relates Dtk::Core::Logger \keyword Dtk::Core::dAssert @brief Check the assertion This macro is a convenient and recommended to use way to call Logger::writeAssert() function. It uses the preprocessor macros (as the dDebug() does) to fill the necessary arguments of the Logger::writeAssert() call. It also uses undocumented but rather mature and stable \c qt_noop() function (which does nothing) when the assertion is true. Example: \code bool b = checkSomething(); ... dAssert(b == true); \endcode @sa Dtk::Core::Logger::writeAssert() */ /*! @~english \macro Dtk::Core::dTraceTime \relates Dtk::Core::Logger \keyword Dtk::Core::dTraceTime @brief Logs the processing time of current function / code block This macro automagically measures the function or code of block execution time and outputs it as a Logger::Trace level log record. Example: \code int foo() { dTraceTime(); ... // Do some long operations return 0; } // Outputs: Function foo finished in