docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class Logger

    A buffered text logger that serializes objects as JSON and writes them to disk via ChunkedStream.

    Inheritance
    object
    BaseLogger
    Logger
    Implements
    IDisposable
    Inherited Members
    BaseLogger._type
    BaseLogger._userPath
    BaseLogger._name
    BaseLogger._extension
    BaseLogger._sequence
    BaseLogger._suffixAction
    BaseLogger._loggerSuffixOption
    BaseLogger.SetOutputPath(string, string, string, string, Func<string>, LoggerSuffixOption)
    BaseLogger.GetPath()
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.SimulationPro
    Assembly: Unity.SimulationPro.Capture.dll
    Syntax
    public class Logger : BaseLogger, IDisposable
    Remarks

    Data is accumulated in memory until the buffer reaches bufferSize kilobytes or the elapsed time since the last flush exceeds the configured maximum, at which point the buffer is flushed asynchronously to a sequenced output file.

    Constructors

    Logger(string, int, int, string, LoggerSuffixOption, Func<string>)

    Initializes a new instance of DataCapture logger with given params.

    Declaration
    public Logger(string logName, int bufferSize = 8192, int maxElapsedSeconds = 5, string userPath = "", LoggerSuffixOption suffixOption = LoggerSuffixOption.SEQ_NO, Func<string> customSuffix = null)
    Parameters
    Type Name Description
    string logName

    Name of the DataCapture Log file.

    int bufferSize

    This corresponds to the file size (in KB). Default is set to 8192.

    int maxElapsedSeconds

    Maximum elapsed time in seconds for the interpolation step.

    string userPath

    Location of the log file. Default is set to Application persistent path.

    LoggerSuffixOption suffixOption

    Option controlling the suffix appended to generated type names.

    Func<string> customSuffix

    Custom suffix string to append to generated type names.

    Properties

    bufferSize

    Gets or sets the buffer size in kilobytes. When the accumulated data reaches this size, the buffer is flushed to disk.

    Declaration
    public int bufferSize { get; set; }
    Property Value
    Type Description
    int

    Methods

    Dispose()

    Disposes the logger and unsubscribes from Manager tick events.

    Declaration
    public void Dispose()

    Flushall(bool)

    Flush data in the buffer to the file system right away. Usually it waits till the size of the buffer reaches to the bufferSize set.

    Declaration
    public void Flushall(bool synchronous = false)
    Parameters
    Type Name Description
    bool synchronous

    Whether data collection should be performed synchronously.

    Log(object)

    Logs the data to the file by appending it to the current buffer.

    Declaration
    public void Log(object parameters)
    Parameters
    Type Name Description
    object parameters

    Serializable struct containing data to be captured.

    Implements

    IDisposable
    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)