⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 284673 in webkit


Ignore:
Timestamp:
Oct 22, 2021, 1:44:02 AM (5 years ago)
Author:
commit-queue@webkit.org
Message:

.:
Enable logging under non-systemd linux distros
https://bugs.webkit.org/show_bug.cgi?id=232080

Patch by Pablo Correa Gómez <ablocorrea@hotmail.com> on 2021-10-22
Reviewed by Michael Catanzaro.

  • Source/cmake/FindJournald.cmake: Renamed from Source/cmake/FindSystemd.cmake.
  • Source/cmake/OptionsGTK.cmake: Replace USE_SYSTEMD for

ENABLE_JOURNALD_LOG

  • Source/cmake/OptionsWPE.cmake: Replace USE_SYSTEMD for

ENABLE_JOURNALD_LOG

Source/WTF:
Enable logging in under non-systemd linux distros
https://bugs.webkit.org/show_bug.cgi?id=232080

Patch by Pablo Correa Gómez <ablocorrea@hotmail.com> on 2021-10-22
Reviewed by Michael Catanzaro.

  • wtf/Assertions.h: Rename USE(JOURNALD) to ENABLE(JOURNALD_LOG)
  • wtf/Logger.h:

(WTF::Logger::willLog const): Rename USE(JOURNALD) to
ENABLE(JOURNALD_LOG)

  • wtf/PlatformGTK.cmake: Use renamed Journald library
  • wtf/PlatformWPE.cmake: Use renamed Journald library
Location:
trunk
Files:
9 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r284666 r284673  
     12021-10-22  Pablo Correa Gómez  <ablocorrea@hotmail.com>
     2
     3        Enable logging under non-systemd linux distros
     4        https://bugs.webkit.org/show_bug.cgi?id=232080
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        * Source/cmake/FindJournald.cmake: Renamed from Source/cmake/FindSystemd.cmake.
     9        * Source/cmake/OptionsGTK.cmake: Replace USE_SYSTEMD for
     10        ENABLE_JOURNALD_LOG
     11        * Source/cmake/OptionsWPE.cmake: Replace USE_SYSTEMD for
     12        ENABLE_JOURNALD_LOG
     13
    1142021-10-21  Eric Carlson  <eric.carlson@apple.com>
    215
  • trunk/Source/WTF/ChangeLog

    r284634 r284673  
     12021-10-22  Pablo Correa Gómez  <ablocorrea@hotmail.com>
     2
     3        Enable logging in under non-systemd linux distros
     4        https://bugs.webkit.org/show_bug.cgi?id=232080
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        * wtf/Assertions.h: Rename USE(JOURNALD) to ENABLE(JOURNALD_LOG)
     9        * wtf/Logger.h:
     10        (WTF::Logger::willLog const): Rename USE(JOURNALD) to
     11        ENABLE(JOURNALD_LOG)
     12        * wtf/PlatformGTK.cmake: Use renamed Journald library
     13        * wtf/PlatformWPE.cmake: Use renamed Journald library
     14
    1152021-10-21  Aditya Keerthi  <akeerthi@apple.com>
    216
  • trunk/Source/WTF/wtf/Assertions.cpp

    r283469 r284673  
    610610            else
    611611                out.printf("%-3d %p", frameNumber, stackFrame);
    612 #if USE(JOURNALD)
     612#if ENABLE(JOURNALD_LOG)
    613613            sd_journal_send("WEBKIT_SUBSYSTEM=%s", channel->subsystem, "WEBKIT_CHANNEL=%s", channel->name, "MESSAGE=%s", out.toCString().data(), nullptr);
    614614#else
  • trunk/Source/WTF/wtf/Assertions.h

    r283469 r284673  
    5252#endif
    5353
    54 #if USE(JOURNALD)
     54#if ENABLE(JOURNALD_LOG)
    5555#define SD_JOURNAL_SUPPRESS_LOCATION
    5656#include <systemd/sd-journal.h>
     
    9999#define RELEASE_LOG_DISABLED 0
    100100#else
    101 #define RELEASE_LOG_DISABLED !(USE(OS_LOG) || USE(JOURNALD))
     101#define RELEASE_LOG_DISABLED !(USE(OS_LOG) || ENABLE(JOURNALD_LOG))
    102102#endif
    103103
    104104#ifndef VERBOSE_RELEASE_LOG
    105 #define VERBOSE_RELEASE_LOG USE(JOURNALD)
     105#define VERBOSE_RELEASE_LOG ENABLE(JOURNALD_LOG)
    106106#endif
    107107
     
    566566} while (0)
    567567
    568 #elif USE(JOURNALD)
     568#elif ENABLE(JOURNALD_LOG)
    569569
    570570#define PUBLIC_LOG_STRING "s"
  • trunk/Source/WTF/wtf/Logger.h

    r283469 r284673  
    3131#include <wtf/text/StringBuilder.h>
    3232
    33 #if USE(JOURNALD)
     33#if ENABLE(JOURNALD_LOG)
    3434#define SD_JOURNAL_SUPPRESS_LOCATION
    3535#include <systemd/sd-journal.h>
     
    242242            return false;
    243243
    244 #if USE(SYSTEMD)
     244#if ENABLE(JOURNALD_LOG)
    245245        if (channel.state == WTFLogChannelState::Off)
    246246            return false;
     
    315315#elif USE(OS_LOG)
    316316        os_log(channel.osLogChannel, "%{public}s", logMessage.utf8().data());
    317 #elif USE(JOURNALD)
     317#elif ENABLE(JOURNALD_LOG)
    318318        sd_journal_send("WEBKIT_SUBSYSTEM=%s", channel.subsystem, "WEBKIT_CHANNEL=%s", channel.name, "MESSAGE=%s", logMessage.utf8().data(), nullptr);
    319319#else
     
    344344        UNUSED_PARAM(line);
    345345        UNUSED_PARAM(function);
    346 #elif USE(JOURNALD)
     346#elif ENABLE(JOURNALD_LOG)
    347347        auto fileString = makeString("CODE_FILE=", file);
    348348        auto lineString = makeString("CODE_LINE=", line);
  • trunk/Source/WTF/wtf/PlatformGTK.cmake

    r284525 r284673  
    8080)
    8181
    82 if (Systemd_FOUND)
    83     list(APPEND WTF_LIBRARIES Systemd::Systemd)
     82if (Journald_FOUND)
     83    list(APPEND WTF_LIBRARIES Journald::Journald)
    8484endif ()
    8585
  • trunk/Source/WTF/wtf/PlatformWPE.cmake

    r284525 r284673  
    5353)
    5454
    55 if (Systemd_FOUND)
    56     list(APPEND WTF_LIBRARIES Systemd::Systemd)
     55if (Journald_FOUND)
     56    list(APPEND WTF_LIBRARIES Journald::Journald)
    5757endif ()
    5858
  • trunk/Source/cmake/FindJournald.cmake

    r284672 r284673  
    2323
    2424#[=======================================================================[.rst:
    25 FindSystemd
     25FindJournald
    2626-----------
    2727
    28 Find Systemd headers and libraries.
     28Find Journald-compatible headers and libraries.
    2929
    3030Imported Targets
    3131^^^^^^^^^^^^^^^^
    3232
    33 ``Systemd::Systemd``
    34   The Systemd library, if found.
     33``Journald::Journald``
     34  The library where Journald symbols reside, if found.
    3535
    3636Result Variables
     
    3939This will define the following variables in your project:
    4040
    41 ``Systemd_FOUND``
    42   true if (the requested version of) Systemd is available.
    43 ``Systemd_VERSION``
    44   the version of Systemd.
    45 ``Systemd_LIBRARIES``
    46   the libraries to link against to use Systemd.
    47 ``Systemd_INCLUDE_DIRS``
    48   where to find the Systemd headers.
    49 ``Systemd_COMPILE_OPTIONS``
     41``Journald_FOUND``
     42  true if (the requested version of) Journald is available.
     43``Journald_VERSION``
     44  the version of the library where Journald symbols reside.
     45``Journald_LIBRARIES``
     46  the libraries to link against to use Journald.
     47``Journald_INCLUDE_DIRS``
     48  where to find the Journald headers.
     49``Journald_COMPILE_OPTIONS``
    5050  this should be passed to target_compile_options(), if the
    5151  target is not used for linking
    5252
    5353#]=======================================================================]
    54 
    5554find_package(PkgConfig QUIET)
    5655
     56# libelogind provides compatible pc and header files
    5757pkg_check_modules(PC_SYSTEMD QUIET libsystemd)
    58 set(Systemd_COMPILE_OPTIONS ${PC_SYSTEMD_CFLAGS_OTHER})
    59 set(Systemd_VERSION ${PC_SYSTEMD_VERSION})
     58set(Journald_COMPILE_OPTIONS ${PC_SYSTEMD_CFLAGS_OTHER})
     59set(Journald_VERSION ${PC_SYSTEMD_VERSION})
    6060
    61 find_path(Systemd_INCLUDE_DIR
     61find_path(Journald_INCLUDE_DIR
    6262    NAMES systemd/sd-journal.h
    6363    HINTS ${PC_SYSTEMD_INCLUDEDIR} ${PC_SYSTEMD_INCLUDE_DIRS}
    6464)
    6565
    66 find_library(Systemd_LIBRARY
    67     NAMES ${Systemd_NAMES} systemd
     66find_library(Journald_LIBRARY
     67    NAMES ${Journald_NAMES} systemd
    6868    HINTS ${PC_SYSTEMD_LIBDIR} ${PC_SYSTEMD_LIBRARY_DIRS}
    6969)
    7070
    71 include(FindPackageHandleStandardArgs)
    72 find_package_handle_standard_args(Systemd
    73     FOUND_VAR Systemd_FOUND
    74     REQUIRED_VARS Systemd_LIBRARY Systemd_INCLUDE_DIR
    75     VERSION_VAR Systemd_VERSION
    76 )
    77 
    78 if (Systemd_LIBRARY AND NOT TARGET Systemd::Systemd)
    79     add_library(Systemd::Systemd UNKNOWN IMPORTED GLOBAL)
    80     set_target_properties(Systemd::Systemd PROPERTIES
    81         IMPORTED_LOCATION "${Systemd_LIBRARY}"
    82         INTERFACE_COMPILE_OPTIONS "${Systemd_COMPILE_OPTIONS}"
    83         INTERFACE_INCLUDE_DIRECTORIES "${Systemd_INCLUDE_DIR}"
     71if (NOT Journald_LIBRARY)
     72    find_library(Journald_LIBRARY
     73        NAMES ${Journald_NAMES} elogind
     74        HINTS ${PC_SYSTEMD_LIBDIR} ${PC_SYSTEMD_LIBRARY_DIRS}
    8475    )
    8576endif ()
    8677
    87 mark_as_advanced(Systemd_INCLUDE_DIR Systemd_LIBRARY)
     78include(FindPackageHandleStandardArgs)
     79find_package_handle_standard_args(Journald
     80    FOUND_VAR Journald_FOUND
     81    REQUIRED_VARS Journald_LIBRARY Journald_INCLUDE_DIR
     82    VERSION_VAR Journald_VERSION
     83)
    8884
    89 if (Systemd_FOUND)
    90     set(Systemd_LIBRARIES ${Systemd_LIBRARY})
    91     set(Systemd_INCLUDE_DIRS ${Systemd_INCLUDE_DIR})
     85if (Journald_LIBRARY AND NOT TARGET Journald::Journald)
     86    add_library(Journald::Journald UNKNOWN IMPORTED GLOBAL)
     87    set_target_properties(Journald::Journald PROPERTIES
     88        IMPORTED_LOCATION "${Journald_LIBRARY}"
     89        INTERFACE_COMPILE_OPTIONS "${Journald_COMPILE_OPTIONS}"
     90        INTERFACE_INCLUDE_DIRECTORIES "${Journald_INCLUDE_DIR}"
     91    )
    9292endif ()
     93
     94mark_as_advanced(Journald_INCLUDE_DIR Journald_LIBRARY)
     95
     96if (Journald_FOUND)
     97    set(Journald_LIBRARIES ${Journald_LIBRARY})
     98    set(Journald_INCLUDE_DIRS ${Journald_INCLUDE_DIR})
     99endif ()
  • trunk/Source/cmake/OptionsGTK.cmake

    r284238 r284673  
    5757WEBKIT_OPTION_DEFINE(ENABLE_GTKDOC "Whether or not to use generate gtkdoc." PUBLIC OFF)
    5858WEBKIT_OPTION_DEFINE(ENABLE_INTROSPECTION "Whether to enable GObject introspection." PUBLIC ON)
     59WEBKIT_OPTION_DEFINE(ENABLE_JOURNALD_LOG "Whether to enable journald logging" PUBLIC ON)
    5960WEBKIT_OPTION_DEFINE(ENABLE_QUARTZ_TARGET "Whether to enable support for the Quartz windowing target." PUBLIC ON)
    6061WEBKIT_OPTION_DEFINE(ENABLE_WAYLAND_TARGET "Whether to enable support for the Wayland windowing target." PUBLIC ON)
     
    6970WEBKIT_OPTION_DEFINE(USE_OPENJPEG "Whether to enable support for JPEG2000 images." PUBLIC ON)
    7071WEBKIT_OPTION_DEFINE(USE_SOUP2 "Whether to enable usage of Soup 2 instead of Soup 3." PUBLIC OFF)
    71 WEBKIT_OPTION_DEFINE(USE_SYSTEMD "Whether to enable journald logging" PUBLIC ON)
    7272WEBKIT_OPTION_DEFINE(USE_WOFF2 "Whether to enable support for WOFF2 Web Fonts." PUBLIC ON)
    7373WEBKIT_OPTION_DEFINE(USE_WPE_RENDERER "Whether to enable WPE rendering" PUBLIC ON)
     
    456456endif ()
    457457
    458 if (USE_SYSTEMD)
    459     find_package(Systemd)
    460     if (Systemd_FOUND)
    461         message(STATUS "Release logs will be sent to the Systemd journal")
    462         SET_AND_EXPOSE_TO_BUILD(USE_JOURNALD TRUE)
     458if (ENABLE_JOURNALD_LOG)
     459    find_package(Journald)
     460    if (Journald_FOUND)
     461        message(STATUS "Release logs will be sent using journald logging interface")
     462        SET_AND_EXPOSE_TO_BUILD(ENABLE_JOURNALD_LOG TRUE)
    463463    else ()
    464         message(FATAL_ERROR "libsystemd is needed for USE_SYSTEMD")
     464        message(FATAL_ERROR "libsystemd or libelogind are needed for ENABLE_JOURNALD_LOG")
    465465    endif ()
    466466endif ()
  • trunk/Source/cmake/OptionsWPE.cmake

    r284603 r284673  
    7474# and the option is not relevant to any other WebKit ports.
    7575WEBKIT_OPTION_DEFINE(ENABLE_GTKDOC "Whether or not to use generate gtkdoc." PUBLIC OFF)
     76WEBKIT_OPTION_DEFINE(ENABLE_JOURNALD_LOG "Whether to enable journald logging" PUBLIC ON)
    7677WEBKIT_OPTION_DEFINE(ENABLE_WPE_QT_API "Whether to enable support for the Qt5/QML plugin" PUBLIC ${ENABLE_DEVELOPER_MODE})
    7778WEBKIT_OPTION_DEFINE(USE_AVIF "Whether to enable support for AVIF images." PUBLIC ${ENABLE_EXPERIMENTAL_FEATURES})
     
    7980WEBKIT_OPTION_DEFINE(USE_OPENJPEG "Whether to enable support for JPEG2000 images." PUBLIC ON)
    8081WEBKIT_OPTION_DEFINE(USE_SOUP2 "Whether to enable usage of Soup 2 instead of Soup 3." PUBLIC OFF)
    81 WEBKIT_OPTION_DEFINE(USE_SYSTEMD "Whether to enable journald logging" PUBLIC ON)
    8282WEBKIT_OPTION_DEFINE(USE_WOFF2 "Whether to enable support for WOFF2 Web Fonts." PUBLIC ON)
    8383
     
    233233endif ()
    234234
    235 if (USE_SYSTEMD)
    236     find_package(Systemd)
    237     if (Systemd_FOUND)
    238         message(STATUS "Release logs will be sent to the Systemd journal")
    239         SET_AND_EXPOSE_TO_BUILD(USE_JOURNALD TRUE)
     235if (ENABLE_JOURNALD_LOG)
     236    find_package(Journald)
     237    if (Journald_FOUND)
     238        message(STATUS "Release logs will be sent using journald logging interface")
     239        SET_AND_EXPOSE_TO_BUILD(ENABLE_JOURNALD_LOG TRUE)
    240240    else ()
    241         message(FATAL_ERROR "libsystemd is needed for USE_SYSTEMD")
     241        message(FATAL_ERROR "libsystemd or libelogind are needed for ENABLE_JOURNALD_LOG")
    242242    endif ()
    243243endif ()
Note: See TracChangeset for help on using the changeset viewer.