LogoLogo
English
English
  • Diarkis Help Center
  • Overview of Diarkis
  • Getting Started
    • Diarkis Server Template
    • Diarkis Client SDK
    • Tutorials
      • 1. Launch Diarkis Server in Local Environment
      • 2. Perform Connectivity Check with Test Client
      • 3. Implement Custom Command
      • Connect to Server from Diarkis Client
    • Samples
  • Diarkis Modules
    • Room Module
      • Set Up Room Module on Server
      • Room Sample
        • room_broadcast
      • Utilizing Room Module from Client
      • Additional Features of Room
    • MatchMaker Module
      • Set Up MatchMaker Module on Server
    • Field Module
      • Set Up Field Module on Server
    • P2P Module
      • Set Up P2P Module on Server
      • P2P Sample
    • DM (Direct Message) Module
      • Set Up DM Module on Server
    • Notifier Module
      • Set Up Notifier Module on Server
    • Session Module
      • Set Up Session Module on Server
    • Group Module
      • Set Up Group Module on Server
  • Diarkis Server
    • Launch Diarkis Server in Cloud Environment
      • AWS
    • Launch Diarkis Server on Windows Environment
    • MARS Server
    • UDP Server
    • TCP Server
    • HTTP Server
    • Metrics API
    • Inter-server Communication - Mesh
  • Diarkis Client
    • Runtime Library
      • Diarkis RUDP
    • Diarkis Module
      • Initialization and Termination of Diarkis Module
      • Customization of Diarkis Module
      • Logging System of Diarkis Module
      • Migration
      • Threads of Diarkis
    • Samples
      • C++
        • room_broadcast
        • directmessage_simple
        • group_sample
        • matching_and_turn
        • matchmaker_ticket
        • p2p_rudp_sample
        • session_simple
      • Unreal Engine Plugin
        • FieldWalker
      • Unity Plugin
        • FieldWalker
          • HowToReplicatePosition.md
  • Diarkis Tools
    • Diarkis CLI
      • Procedures to Switch to Diarkis CLI v3
  • References
    • API Reference
    • Release Notes
      • v1.0
      • v1.0.1
      • v1.0.2
      • v1.0.3
      • v1.0.4
      • v1.0.5
      • v1.0.6
  • Support
    • License and Billing
Powered by GitBook
On this page
  • Overview
  • Logging System Configuration
  • Log Output Methods of Diarkis Module
  • Log Output Levels
  • Log Content Checkable by Category
  • Implementing a Custom Logger

Was this helpful?

  1. Diarkis Client
  2. Diarkis Module

Logging System of Diarkis Module

Overview and setup of the logging system for the Diarkis Module.

Overview

This page explains the logging system of the Diarkis Module.

The Diarkis Module outputs logs from the Diarkis runtime library as well as from its own operations. The output logs can be checked in various ways such as via standard output and file output. If the system does not operate as expected or if you need to verify the running state of the Diarkis runtime, it is recommended to first check the contents of the log file.

Logging System Configuration

Settings for the Diarkis Module's logging system are controlled via arguments passed to DiarkisInterfaceBase::DiarkisInit(). You can configure the log directory name, output methods, whether or not to output logs, etc.

Log Output Methods of Diarkis Module

The Diarkis Module supports the following output methods:

enum
Description

DEBUG_OUT

Outputs logs to the debugger if possible; if not, logs are output to standard output

FILE_OUT

Outputs logs to a file, specifically named diarkis-log.log at the path obtained by GetLogDirectoryPath()

FILE_OUT_SPECIFIC_PATH

Outputs log files to a specified path

CONSOLE_OUT

Outputs logs to standard output

DEBUG_AND_FILE_OUT

Combines the behavior of DEBUG_OUT and FILE_OUT

CUSTOM

Outputs logs to a user-defined custom logger

Log Output Levels

The logging system of the Diarkis Module allows for adjustment of the detail level of log outputs. The default log output level is specified in the constructor of LoggerFactory, implemented in diarkis-module\Client\Private\logging\LoggerFactory.cpp. This default can be changed, and it is also possible to dynamically alter it during application execution using LoggerFactory::SetSeverity().

The log output levels are as follows. The settings lower in the list provide more detailed logs. Higher detailed log levels always include lower levels. Note that using Verbose or Trace may impact the runtime speed of Diarkis or result in large log files, so caution is advised.

enum
Description

None

Does not output logs

Fatal

Outputs logs for fatal errors

Error

Outputs logs including general errors

Warning

Outputs logs including warnings

Info

Outputs logs with additional information

Debug

Outputs logs with debugging information

Verbose

Outputs logs with detailed debugging information

Trace

Outputs logs as detailed as possible regarding runtime operations and payload transmissions

Log Content Checkable by Category

The client library's logging system allows for changes to the log level for each category. Adjust the log level of the necessary category according to the information you wish to verify during debugging.

Representative Categories
Contents Verifiable During Debugging

UDP

Verification of Connect, Disconnect with the UDP server. When unintended disconnection occurs or to check ack, eack during packet loss

RUDP

When packet loss occurs, to check the process status of RUDP packets and sequence numbers

Socket

To verify socket-related processes when an unintended disconnection happens

P2P

To check for any unintended issues during P2P communications such as hole punching or packet transmissions

Runtime

To verify when notifications or responses from the server do not arrive during the application implementation

Room and each Module Category

To verify packet transmissions and unreceived notifications or responses from the server during the implementation of each module

Implementing a Custom Logger

Using a custom logger allows the user to freely customize the logger's functionality. By inheriting from ILoggerBackend and overriding ILoggerBackend::Log(), you can handle the log output process of the Diarkis runtime and the Diarkis Module. Below is a sample implementation.

// Sample implementation for application-specific custom log output
class AppCustomLoggerBackend : public ILoggerBackend
{
    public:
        AppCustomLoggerBackend() {}
        virtual ~AppCustomLoggerBackend() {}

        virtual Result Log(const Diarkis::StdString& message, bool includeNewLine) override
        {
            // Log text is passed as message, allowing for application-specific log output
            // Exclusive control is performed so there is no issue with calls from multiple threads
            DiarkisUtils::Print("%s", message.c_str());
            return Diarkis::Results::SUCCESS;
        }
};

...
// Pseudo code specifying a custom logger during initialization
AppCustomLoggerBackend customLogger;

DiarkisInterface::DiarkisInit(uid, LogOutType::CUSTOM, bOutLog, &customLogger);
PreviousCustomization of Diarkis ModuleNextMigration

Last updated 2 months ago

Was this helpful?