Skip to content

Commit

Permalink
442 logging module restructuring. (#443)
Browse files Browse the repository at this point in the history
* logging module restructuring.
  • Loading branch information
aregtech authored Nov 14, 2024
1 parent 9cd24a5 commit 9be7ffc
Show file tree
Hide file tree
Showing 258 changed files with 5,847 additions and 5,969 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ The fault-tolerant design of AREG offers key advantages, such as:
The **AREG SDK** consists of several modules to streamline distributed, real-time applications development:
- **[AREG Communication Engine (*areg*)](./framework/areg/):** Core framework enabling communication between software components.
- **[Multicast Router (_mcrouter_)](./framework/mcrouter/):** Facilitates message routing between services.
- **[Log Collector (*logger*)](./framework/logger/):** Collects logs from various applications and forwards them to log observers.
- **[Log Collector (*logcollector*)](./framework/logcollector/):** Collects logs from applications and forwards them to log observers.
- **[Log observer Library (*areglogger*)](./framework/areglogger/):** Library for receiving logs from the log collector service.
- **[Log observer (*logobserver*)](./framework/logobserver/):** In real-time mode monitors, saves and dynamically controls logs.
- **[AREG Extended Library (*aregextend*)](./framework/aregextend/):** Offers additional objects with extended features.
Expand Down Expand Up @@ -314,7 +314,7 @@ You can also set up multiprocess applications using same components and changing
### Multicast Router and Log Collector
Both **mcrouter** and **logger** are essential components for communication and log collection. Configuration templates for the multicast router and log collector services are provided in the `areg.init` file. Both processes are designed to run as console applications or as **Operating System managed** services.
Both **mcrouter** and **logcollector** are essential components for communication and log collection. Configuration templates for the multicast router and log collector services are provided in the `areg.init` file. Both processes are designed to run as console applications or as **Operating System managed** services.
For in-depth details of building and using these applications, review the descriptions in **[Multicast Router Service](./docs/wiki/05a-mcrouter.md)** and **[Log Collector Service](./docs/wiki/04d-logcollector.md)** pages. *Discover how the AREG SDK's Multicast Router and Log Collector streamline communication and logging in edge computing and real-time data transfer systems.*
Expand All @@ -333,7 +333,7 @@ The AREG SDK offers hands-on examples demonstrating **Multithreading** and **Mul
**Some Featured Examples:**
1. **[00_helloservice](./examples/00_helloservice/)**: Master service creation across single-threaded, multi-threaded, and multi-process environments, showcasing AREG's intuitive, interface-driven approach.
2. **[04_trace](./examples/04_trace/)**: Configure and manage logging to track application behavior, aiding debugging, performance analysis, and log management.
2. **[04_logging](./examples/04_logging/)**: Configure and manage logging to track application behavior, aiding debugging, performance analysis, and log management.
3. **[16_pubfsm](./examples/16_pubfsm/)**: Build and control a *Finite-State Machine (FSM)* with AREG's *Timers* and *Events* for smooth state transitions.
Expand Down
10 changes: 5 additions & 5 deletions areg-sdk.sln
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "03_file", "examples\03_file
{2DF8165C-EDE2-4F76-8D2C-2FFE82CB6CE5} = {2DF8165C-EDE2-4F76-8D2C-2FFE82CB6CE5}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "04_trace", "examples\04_trace\04_trace.vcxproj", "{18F81610-018F-4FE9-9B33-D2060E0F2CB6}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "04_logging", "examples\04_logging\04_logging.vcxproj", "{18F81610-018F-4FE9-9B33-D2060E0F2CB6}"
ProjectSection(ProjectDependencies) = postProject
{2DF8165C-EDE2-4F76-8D2C-2FFE82CB6CE5} = {2DF8165C-EDE2-4F76-8D2C-2FFE82CB6CE5}
EndProjectSection
Expand Down Expand Up @@ -530,7 +530,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "services", "services", "{C4
examples\21_pubunblock\services\HelloUnblock.siml = examples\21_pubunblock\services\HelloUnblock.siml
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "logger", "framework\logger.vcxproj", "{0A2D4D13-6AC2-4602-BF8F-DA73133C1974}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "logcollector", "framework\logcollector.vcxproj", "{0A2D4D13-6AC2-4602-BF8F-DA73133C1974}"
ProjectSection(ProjectDependencies) = postProject
{2DF8165C-EDE2-4F76-8D2C-2FFE82CB6CE5} = {2DF8165C-EDE2-4F76-8D2C-2FFE82CB6CE5}
{FBC5BEAE-01B9-4943-A5CB-0D3DE2067EB3} = {FBC5BEAE-01B9-4943-A5CB-0D3DE2067EB3}
Expand Down Expand Up @@ -672,9 +672,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "exports", "exports", "{60EE
conf\exports\aregextend.pc.in = conf\exports\aregextend.pc.in
conf\exports\areglogger.pc.in = conf\exports\areglogger.pc.in
conf\exports\config.cmake.in = conf\exports\config.cmake.in
conf\exports\logger.service.in = conf\exports\logger.service.in
conf\exports\logger.service.install.bat.in = conf\exports\logger.service.install.bat.in
conf\exports\logger.service.uninstall.bat.in = conf\exports\logger.service.uninstall.bat.in
conf\exports\logcollector.service.in = conf\exports\logcollector.service.in
conf\exports\logcollector.service.install.bat.in = conf\exports\logcollector.service.install.bat.in
conf\exports\logcollector.service.uninstall.bat.in = conf\exports\logcollector.service.uninstall.bat.in
conf\exports\mcrouter.service.in = conf\exports\mcrouter.service.in
conf\exports\mcrouter.service.install.bat.in = conf\exports\mcrouter.service.install.bat.in
conf\exports\mcrouter.service.uninstall.bat.in = conf\exports\mcrouter.service.uninstall.bat.in
Expand Down
13 changes: 8 additions & 5 deletions conf/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Configurations
This document is a short introduction of folder content and configuration for different toolsets.
# Configuration Overview

## CMakeLists
The folder [./cmake](./cmkae/) contains project common and developer specific settings. Normally, it is expected to make custom changes only in the [user.cmake](./cmake/user.cmake) file. The content of the folder has impact when build project with `cmake` tool.
This document provides a brief overview of the configuration directory's contents and instructions for setting up configurations for various toolsets.

## CMake
The [./cmake](./cmake/) directory contains project-wide and developer-specific settings for building with CMake. Direct modifications to files within this directory are generally unnecessary. Instead, use the options in [user.cmake](./cmake/user.cmake) to customize the build configuration.

## Microsoft Visual Studio
The folder [./msvc](./msvc/) contains Microsoft Visual Studio specific property files that are included in projects. Normally, it is expected to make custom changes only in the [./msvc/user.props](./msvc/user.props) file. The content of the foler has impact with build project with `MSBuild` build.
The [./msvc](./msvc/) directory includes Visual Studio-specific property files referenced by the project. Directly modifying `.props` files is not recommended. To customize your build, copy the [msvc_setup.props](./../msvc_setup.props) file into your solution directory and apply necessary changes there.

For further information, consult the [wiki](./../docs/wiki/README.md) documentation.
7 changes: 7 additions & 0 deletions conf/cmake/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ elseif("${AREG_COMPILER_SHORT}" STREQUAL "")

endif()

if ("${AREG_PROCESSOR}" STREQUAL "")
set(AREG_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR})
endif()
if ("${AREG_BITNESS}" STREQUAL "" OR AREG_BITNESS EQUAL 0)
macro_system_bitness(AREG_BITNESS)
endif()

# Identify the OS
set(AREG_OS ${CMAKE_SYSTEM_NAME})
# Identify CPU platform
Expand Down
2 changes: 1 addition & 1 deletion conf/cmake/functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ function(printAregConfigStatus var_make_print var_prefix var_header var_footer)
message(STATUS "${var_prefix}: >>> Binary Output Dir ..: '${CMAKE_RUNTIME_OUTPUT_DIRECTORY}'")
message(STATUS "${var_prefix}: >>> Generated Files Dir : '${AREG_GENERATE_DIR}'")
message(STATUS "${var_prefix}: >>> Packages Dir .......: '${FETCHCONTENT_BASE_DIR}'")
message(STATUS "${var_prefix}: >>> Build Modules ......: areg = '${AREG_BINARY}', aregextend = static, areglogger = '${AREG_LOGGER_LIB}', executable extension '${CMAKE_EXECUTABLE_SUFFIX}'")
message(STATUS "${var_prefix}: >>> Build Modules ......: areg = '${AREG_BINARY}', aregextend = static, areglogger = '${AREG_LOGGER_BINARY}', executable extension '${CMAKE_EXECUTABLE_SUFFIX}'")
message(STATUS "${var_prefix}: >>> Java Version .......: '${Java_VERSION_STRING}', Java executable = '${Java_JAVA_EXECUTABLE}', minimum version required = 17")
message(STATUS "${var_prefix}: >>> Packages Use .......: SQLite3 package use = '${AREG_SQLITE_PACKAGE}', GTest package use = '${AREG_GTEST_PACKAGE}'")
message(STATUS "${var_prefix}: >>> Other Options ......: Examples = '${AREG_BUILD_EXAMPLES}', Unit Tests = '${AREG_BUILD_TESTS}', AREG Extended = '${AREG_EXTENDED}', Logs = '${AREG_LOGS}'")
Expand Down
32 changes: 16 additions & 16 deletions conf/cmake/install.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ set(AREG_INSTALL_DST "${CMAKE_INSTALL_PREFIX}")
target_include_directories(areg PUBLIC $<INSTALL_INTERFACE:include>)
target_include_directories(aregextend PUBLIC $<INSTALL_INTERFACE:include>)
target_include_directories(areglogger PUBLIC $<INSTALL_INTERFACE:include>)
target_include_directories(logger PUBLIC $<INSTALL_INTERFACE:include>)
target_include_directories(logcollector PUBLIC $<INSTALL_INTERFACE:include>)
target_include_directories(logobserver PUBLIC $<INSTALL_INTERFACE:include>)
target_include_directories(mcrouter PUBLIC $<INSTALL_INTERFACE:include>)

target_link_directories(areg PUBLIC $<INSTALL_INTERFACE:lib> $<INSTALL_INTERFACE:bin>)
target_link_directories(aregextend PUBLIC $<INSTALL_INTERFACE:lib> $<INSTALL_INTERFACE:bin>)
target_link_directories(areglogger PUBLIC $<INSTALL_INTERFACE:lib> $<INSTALL_INTERFACE:bin>)
target_link_directories(logger PUBLIC $<INSTALL_INTERFACE:lib> $<INSTALL_INTERFACE:bin>)
target_link_directories(logcollector PUBLIC $<INSTALL_INTERFACE:lib> $<INSTALL_INTERFACE:bin>)
target_link_directories(logobserver PUBLIC $<INSTALL_INTERFACE:lib> $<INSTALL_INTERFACE:bin>)
target_link_directories(mcrouter PUBLIC $<INSTALL_INTERFACE:lib> $<INSTALL_INTERFACE:bin>)

Expand All @@ -32,9 +32,9 @@ install(DIRECTORY framework/
FILES_MATCHING
PATTERN "*.h"
PATTERN "*.hpp"
PATTERN "logger" EXCLUDE
PATTERN "logobserver" EXCLUDE
PATTERN "mcrouter" EXCLUDE
PATTERN "logcollector" EXCLUDE
PATTERN "logobserver" EXCLUDE
PATTERN "mcrouter" EXCLUDE
)

# Copy compiled binaries in the bin and lib directories
Expand Down Expand Up @@ -88,8 +88,8 @@ install(DIRECTORY tools/
CONFIGURATIONS Release
)

# Copy compiled AREG SDK tools: logger, logobserver and mcrouter
install(TARGETS logger logobserver mcrouter
# Copy compiled AREG SDK tools: logcollector, logobserver and mcrouter
install(TARGETS logcollector logobserver mcrouter
EXPORT ${AREG_PACKAGE_NAME}
RUNTIME DESTINATION tools/${AREG_PACKAGE_NAME}
COMPONENT Development COMPONENT Runtime
Expand Down Expand Up @@ -128,13 +128,13 @@ install(FILES
# configure and copy servicing script files.
if ((WIN32) OR (CYGWIN))

configure_file("${AREG_EXPORTS_DIR}/logger.service.install.bat.in" exports/logger.service.install.bat @ONLY)
configure_file("${AREG_EXPORTS_DIR}/logger.service.uninstall.bat.in" exports/logger.service.uninstall.bat @ONLY)
configure_file("${AREG_EXPORTS_DIR}/mcrouter.service.install.bat.in" exports/mcrouter.service.install.bat @ONLY)
configure_file("${AREG_EXPORTS_DIR}/mcrouter.service.uninstall.bat.in" exports/mcrouter.service.uninstall.bat @ONLY)
configure_file("${AREG_EXPORTS_DIR}/logcollector.service.install.bat.in" exports/logcollector.service.install.bat @ONLY)
configure_file("${AREG_EXPORTS_DIR}/logcollector.service.uninstall.bat.in" exports/logcollector.service.uninstall.bat @ONLY)
configure_file("${AREG_EXPORTS_DIR}/mcrouter.service.install.bat.in" exports/mcrouter.service.install.bat @ONLY)
configure_file("${AREG_EXPORTS_DIR}/mcrouter.service.uninstall.bat.in" exports/mcrouter.service.uninstall.bat @ONLY)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/exports/logger.service.install.bat"
"${CMAKE_CURRENT_BINARY_DIR}/exports/logger.service.uninstall.bat"
"${CMAKE_CURRENT_BINARY_DIR}/exports/logcollector.service.install.bat"
"${CMAKE_CURRENT_BINARY_DIR}/exports/logcollector.service.uninstall.bat"
"${CMAKE_CURRENT_BINARY_DIR}/exports/mcrouter.service.install.bat"
"${CMAKE_CURRENT_BINARY_DIR}/exports/mcrouter.service.uninstall.bat"
DESTINATION share/${AREG_PACKAGE_NAME}/service
Expand All @@ -145,10 +145,10 @@ if ((WIN32) OR (CYGWIN))

else()

configure_file("${AREG_EXPORTS_DIR}/logger.service.in" "exports/logger.service" @ONLY)
configure_file("${AREG_EXPORTS_DIR}/mcrouter.service.in" "exports/mcrouter.service" @ONLY)
configure_file("${AREG_EXPORTS_DIR}/logcollector.service.in" "exports/logcollector.service" @ONLY)
configure_file("${AREG_EXPORTS_DIR}/mcrouter.service.in" "exports/mcrouter.service" @ONLY)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/exports/logger.service"
"${CMAKE_CURRENT_BINARY_DIR}/exports/logcollector.service"
"${CMAKE_CURRENT_BINARY_DIR}/exports/mcrouter.service"
DESTINATION share/${AREG_PACKAGE_NAME}/service
COMPONENT Development COMPONENT Runtime
Expand Down
19 changes: 7 additions & 12 deletions conf/cmake/user.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# 2. AREG_COMPILER -- Sets a specific compiler for both C++ and C projects.
# 3. AREG_PROCESSOR -- The processor architect. Ignore if need to use system default.
# 4. AREG_BINARY -- Specifies the library type for the AREG Framework ('shared' or 'static'). Defaults to 'shared'.
# 5. AREG_LOGGER_LIB -- Specifies the type of the Log Observer API library ('shared' or 'static'). Defaults to 'shared'.
# 5. AREG_LOGGER_BINARY -- Specifies the type of the Log Observer API library ('shared' or 'static'). Defaults to 'shared'.
# 6. AREG_BUILD_TYPE -- Specifies the build configuration ('Debug' or 'Release').
# 7. AREG_BUILD_TESTS -- Enables or disables building unit tests for the AREG Framework.
# 8. AREG_BUILD_EXAMPLES -- Enables or disables building examples for the AREG Framework.
Expand All @@ -35,7 +35,7 @@
# 2. AREG_COMPILER = <default> (possible values: g++, gcc, c++, cc, clang++, clang, clang-cl, cl)
# 3. AREG_PROCESSOR = System (possible values: x86, x64 (x86_64, amd64), arm (arm32), aarch64 (arm64))
# 4. AREG_BINARY = shared (possible values: shared, static)
# 5. AREG_LOGGER_LIB = shared (possible values: shared, static)
# 5. AREG_LOGGER_BINARY = shared (possible values: shared, static)
# 6. AREG_BUILD_TYPE = Release (possible values: Release, Debug)
# 7. AREG_BUILD_TESTS = ON (possible values: ON, OFF)
# 8. AREG_BUILD_EXAMPLES = ON (possible values: ON, OFF)
Expand Down Expand Up @@ -97,12 +97,7 @@ if (DEFINED AREG_PROCESSOR)
set(AREG_BITNESS 64)
else()
set(CMAKE_SYSTEM_PROCESSOR ${AREG_PROCESSOR})
if (NOT DEFINED AREG_BITNESS)
macro_system_bitness(AREG_BITNESS)
endif()
endif()
elseif(NOT DEFINED AREG_BITNESS)
macro_system_bitness(AREG_BITNESS)
endif()

# If CMake compilers are specified, use them
Expand Down Expand Up @@ -221,14 +216,14 @@ elseif (NOT "${AREG_BINARY}" STREQUAL "static")
endif()

# Set the areg log observer API library type.
if (NOT DEFINED AREG_LOGGER_LIB)
if (NOT DEFINED AREG_LOGGER_BINARY)
if (DEFINED VCPKG_LIBRARY_LINKAGE AND "${VCPKG_LIBRARY_LINKAGE}" STREQUAL "static")
set(AREG_LOGGER_LIB "static")
set(AREG_LOGGER_BINARY "static")
else()
set(AREG_LOGGER_LIB "shared")
set(AREG_LOGGER_BINARY "shared")
endif()
elseif (NOT "${AREG_LOGGER_LIB}" STREQUAL "static")
set(AREG_LOGGER_LIB "shared")
elseif (NOT "${AREG_LOGGER_BINARY}" STREQUAL "static")
set(AREG_LOGGER_BINARY "shared")
endif()

# Build tests. By default it is disabled. To enable, set ON
Expand Down
4 changes: 2 additions & 2 deletions conf/exports/config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ set(AREG_BUILD_TYPE @AREG_BUILD_TYPE@)
# The library type of 'areg'. Static or dynamic
set(AREG_BINARY @AREG_BINARY@)
# The library type of 'areglogger'. Static or dynamic.
set(AREG_LOGGER_LIB @AREG_LOGGER_LIB@)
set(AREG_LOGGER_BINARY @AREG_LOGGER_BINARY@)

# set platform specific variables.
set(AREG_OS @AREG_OS@)
Expand Down Expand Up @@ -77,7 +77,7 @@ else()
endif()

# Indicate the import flag of 'areg' library
if (AREG_LOGGER_LIB MATCHES "shared")
if (AREG_LOGGER_BINARY MATCHES "shared")
add_definitions(-DIMP_LOGGER_DLL)
else()
add_definitions(-DIMP_LOGGER_LIB)
Expand Down
20 changes: 20 additions & 0 deletions conf/exports/logcollector.service.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[Unit]
Description=AREG TCP/IP Logging Service to collect application logs
StartLimitIntervalSec=1

[Service]
# Set the full path to logcollector.out file and start with option '--service'
ExecStart=@AREG_INSTALL_DST@/tools/@AREG_PACKAGE_NAME@/logcollector.out --service
Type=simple
Restart=on-failure
RestartSec=1

[Install]
WantedBy=multi-user.target
Alias=logcollector.service

# Run this file under Linux with admin rights to enable, start or stop AREG Log Collector Service.
# Example:
# Enable service: sudo systemctl enable logcollector.service
# Start service: sudo systemctl start logcollector.service
# Stop service: sudo systemctl stop logcollector.service
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
rem : To install the AREG Log Collector Service on local machine
rem : run this file under Windows with Administrator rights

@AREG_INSTALL_DST@/tools/@AREG_PACKAGE_NAME@/logger.exe --install
@AREG_INSTALL_DST@/tools/@AREG_PACKAGE_NAME@/logcollector.exe --install

exit
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
rem : To uninstall the AREG Log Collector Service on local machine
rem : run this file under Windows with Administrator rights

@AREG_INSTALL_DST@/tools/@AREG_PACKAGE_NAME@/logger.exe --uninstall
@AREG_INSTALL_DST@/tools/@AREG_PACKAGE_NAME@/logcollector.exe --uninstall

exit
20 changes: 0 additions & 20 deletions conf/exports/logger.service.in

This file was deleted.

Loading

0 comments on commit 9be7ffc

Please sign in to comment.