Logging

Logger class is used to print message for information and debugging purpose. FigNet Supports serilog as default logger.

File logging can be enabled from ServerConfig.xml it will log into a text file instead of console. Logs output dir is logs/filename.txt at root level of Application.

Interface

namespace FigNet.Core
{
    public interface ILogger
    {
        void Error(string info);
        void Error(string info, params object[] args);
        void Exception(Exception exception, string info);
        void Exception(Exception exception, string info, params object[] args);
        void Info(string info);
        void Info(string info, params object[] args);
        void SetUp(bool enableFileLogging, string fileName);
        void Warning(string info);
        void Warning(string info, params object[] args);
    }
}

Usage

Logging Level

FigNet provider following logging level that can be set or changed from ServerConfig.xml using LoggingLevel tag

Levels

Description

NONE

disable logging

INFO

print log messages as-is with timestep only

DEBUG

INFO + log info of data sent and received over network that includes Message Id, IsEncrypted, CallbackId, DeliveryMode, ChannelId, Message Size

ALL

DEBUG + log content of the message as hex code

Example of Logging level set to DEBUG

Example of Logging level set to ALL

Helper Methods

During troubleshooting when logging level is set to ALL, the logs become overwhelmed due to the amount of data being logs. FigNet provides helper methods that can be used to subscribe to particular messages only at runtime. If not message is subscribed then logger will print info for all network message else it will print logs of subscribed message only

Or add SubscribeDebugMessages node in Configuration file

On Unity side when logging level is set to all Add button will appear add message Ids as needed

  • In Unity SDK default logger is a wrapper over unity’s Debug.Log

  • Logs output dir is logs/.txt at root level of Application.

Last updated

Was this helpful?