Adding a log server and output channels to a solution

The LogrrServer program sends messages to one or more output channels. You can write log messages to files by using the output channel named FsOutputChannel.

If you do not need to centrally process and store logs, you can skip adding a log server and output channels to your solution and instead use the LogRR component API for logging. In this case, you will be able to add a log server and output channels at any time if you will need them.

Adding and configuring logging server

The command for creating and configuring the log server create_logrr_server() may contain the following parameters:

To add the LogrrServer program to a solution:

Edit the root file containing the CMake commands for building the solution or the file containing the CMake commands for building the Einit initializing program:

CMakeLists.txt

include (logrr_server/configure)

include (logrr_fs_output_channel/configure)

# ...

set (TASKS

# ...

ClientOne)

# ...

# Add the server that uses the output channel FsOutputChannel

create_logrr_server(

LOG_LEVEL DEBUG

WRITE_TO_CORE ON

OUTPUT_CHANNELS

logrr.FsOutputChannel)

# Adding a server and output channel to a solution

list(APPEND TASKS

logrr_server::default_entity

logrr_fs_output_channel::default_entity)

# Create static IPC channels for source programs to connect to the server

connect_to_logrr_server (ENTITIES ClientOne)

build_kos_qemu_image (kos-qemu-image

CONNECTIONS_CFG ${INIT_YAML_FILE}

SECURITY_PSL ${SECURITY_PSL_FILE}

PACK_DEPS_COPY_ONLY ON

PACK_DEPS_LIBS_PATH path_to_libs_dir

PACK_DEPS_COPY_TARGET copylibs

${TASKS})

The PACK_DEPS_COPY_ONLY, PACK_DEPS_LIBS_PATH, and PACK_DEPS_COPY_TARGET options must be enabled when calling build_kos_qemu_image() or build_kos_hw_image() to automatically search and build the dynamic libraries logrr_cpp and Logrr in the disk image.

Adding and configuring output channels

The command for creating and configuring the channel for printing logs to files create_logrr_fs_output_channel() may contain the following parameters:

To add the FsOutputChannel to a solution:

Edit the root file containing the CMake commands for building the solution or the file containing the CMake commands for building the Einit initializing program:

CMakeLists.txt

find_package (logrr_fs_output_channel REQUIRED COMPONENTS ENTITY)

# Add the FsOutputChannel that writes to the file

create_logrr_fs_output_channel (

LOG_DIR "/log")

Creating IPC channels and allowing interaction between programs

The build system automatically creates IPC channels required for the log system to work, and generates a security policy description that allows interaction between processes.

To create a static connection to the log server, you can use the CMake command connect_to_logrr_server (ENTITIES <names_of_programs_to_connect>).

Page top