Add a default configuration profile for Logray.

Add and install default coloring rules and filter buttons for Logray.
Add is_packet_configuration_namespace() and use it to set the default
timestamp type for Logray to "Absolute", which is more appropriate for
log entries.
This commit is contained in:
Gerald Combs 2022-06-17 15:22:26 -07:00
parent 75efbb1ac4
commit f296a00f09
6 changed files with 62 additions and 3 deletions

View File

@ -1570,6 +1570,24 @@ endif()
set(DATAFILE_DIR ${_datafile_dir} CACHE INTERNAL "Build time data file location.")
if(ENABLE_APPLICATION_BUNDLE)
if(CMAKE_CFG_INTDIR STREQUAL ".")
set(_log_datafile_dir "${CMAKE_BINARY_DIR}/run/Logray.app/Contents/Resources/share/logray")
else()
# Xcode
set(_log_datafile_dir "${CMAKE_BINARY_DIR}/run/${CMAKE_CFG_INTDIR}/Logray.app/Contents/Resources/share/logray")
endif()
set(LOG_DATAFILE_DIR ${_log_datafile_dir} CACHE INTERNAL "Build time log analysis data file location.")
# XXX We need to update wsutil/filesystem.c and packaging/nsis/*logray* to match.
# elseif(NOT CMAKE_CFG_INTDIR STREQUAL ".")
# # Visual Studio, Xcode, etc.
# set(_log_datafile_dir "${CMAKE_BINARY_DIR}/run/${CMAKE_CFG_INTDIR}/share/logray")
# else()
# # Makefile, Ninja, etc.
# set(_log_datafile_dir "${CMAKE_BINARY_DIR}/run/share/logray")
endif()
# wsutil must be added after DATAFILE_DIR is set such that filesystem.c can
# learn about the directory location.
add_subdirectory( wsutil )
@ -1946,6 +1964,13 @@ set(INSTALL_FILES
wka
)
if (BUILD_logray)
set(LOG_INSTALL_FILES
resources/share/logray/colorfilters
resources/share/logray/dfilter_buttons
)
endif()
if (ASCIIDOCTOR_FOUND)
list(APPEND INSTALL_FILES
${CMAKE_BINARY_DIR}/doc/AUTHORS-SHORT
@ -2232,6 +2257,23 @@ foreach(_install_file ${INSTALL_FILES})
list(APPEND copy_data_files_depends "${_output_file}")
endforeach()
if (BUILD_logray AND ENABLE_APPLICATION_BUNDLE)
foreach(_install_file ${LOG_INSTALL_FILES})
get_filename_component(_install_file_src "${_install_file}" ABSOLUTE)
get_filename_component(_install_basename "${_install_file}" NAME)
set(_output_file "${LOG_DATAFILE_DIR}/${_install_basename}")
add_custom_command(OUTPUT "${_output_file}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${_install_file_src}"
"${_output_file}"
DEPENDS
docs
"${_install_file}"
)
list(APPEND copy_data_files_depends "${_output_file}")
endforeach()
endif()
# Install Lua files in staging directory such that Lua can used when Wireshark
# is ran from the build directory. For install targets, see
# epan/wslua/CMakeLists.txt

View File

@ -0,0 +1,5 @@
# This file is automatically generated, DO NOT MODIFY.
"TRUE","S3","ct.shortsrc == \x22s3\x22","S3 events"
"TRUE","EC2","ct.shortsrc == \x22ec2\x22","EC2 events"
"TRUE","S3 PutObject","ct.name == \x22PutObject\x22",""
"TRUE","Writes","ct.readonly == \x22false\x22",""

View File

@ -1094,8 +1094,8 @@ read_set_recent_pair_static(gchar *key, const gchar *value,
} else if (strcmp(key, RECENT_KEY_PACKET_LIST_COLORIZE) == 0) {
parse_recent_boolean(value, &recent.packet_list_colorize);
} else if (strcmp(key, RECENT_GUI_TIME_FORMAT) == 0) {
recent.gui_time_format =
(ts_type)str_to_val(value, ts_type_values, TS_RELATIVE);
recent.gui_time_format = (ts_type)str_to_val(value, ts_type_values,
is_packet_configuration_namespace() ? TS_RELATIVE : TS_ABSOLUTE);
} else if (strcmp(key, RECENT_GUI_TIME_PRECISION) == 0) {
recent.gui_time_precision =
(ts_precision)str_to_val(value, ts_precision_values, TS_PREC_AUTO);

View File

@ -69,7 +69,7 @@ static char *get_appcast_update_url(software_update_channel_e chan) {
const char *su_application = get_configuration_namespace();
const char *su_version = VERSION;
if (g_str_has_prefix(su_application, "Log")) {
if (!is_packet_configuration_namespace()) {
su_version = LOG_VERSION;
}

View File

@ -309,6 +309,11 @@ get_configuration_namespace(void)
return CONFIGURATION_NAMESPACE_PROPER;
}
bool is_packet_configuration_namespace(void)
{
return configuration_namespace != CONFIGURATION_NAMESPACE_LOGRAY;
}
#ifndef _WIN32
/*
* Get the pathname of the executable using various platform-

View File

@ -45,6 +45,13 @@ WS_DLL_PUBLIC char *configuration_init(const char *arg0, const char *namespace_n
*/
WS_DLL_PUBLIC const char *get_configuration_namespace(void);
/**
* Check to see if the configuration namespace is for packet analysis
* (Wireshark) or log analysis (Logray).
* @return true if the configuration namespace is for packets.
*/
WS_DLL_PUBLIC bool is_packet_configuration_namespace(void);
/*
* Get the directory in which the program resides.
*/