{!See https://docs.google.com/document/d/1takg_GmIBBKKTj-GHZCwzxohpQz7Bhekivkk72kYMtE/edit for reference implementation of OneTrust, dataLayer and GTM} {!OneTrust Cookies Consent} {!OneTrust Cookies Consent end} {!dataLayer initialization push} {!dataLayer initialization push end} {!Google Tag Manager} {!Google Tag Manager end} Method ParseMessage | Unity Logging | 1.1.0-pre.3
docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method ParseMessage

    ParseMessage(ref FixedString512Bytes, in LogMessage, ref FormatterStruct, ref UnsafeText, ref FixedString512Bytes, ref LogMemoryManager)

    Processes a TextLogger message and returns a text string containing the message text along with the context data referenced in the message.

    Declaration
    public static int ParseMessage(ref FixedString512Bytes template, in LogMessage messageData, ref FormatterStruct formatter, ref UnsafeText messageOutput, ref FixedString512Bytes errorMessage, ref LogMemoryManager memAllocator)
    Parameters
    Type Name Description
    FixedString512Bytes template

    Template for the message, like '{Timestamp} | {Level} | {Message}'

    LogMessage messageData

    A LogMessage generated by the TextLogger to generated formatted output for.

    FormatterStruct formatter

    Formatter that sink is using

    UnsafeText messageOutput

    Returns the text output generated from the log message.

    FixedString512Bytes errorMessage

    Returns an error message string, should a problem parsing the message occur.

    LogMemoryManager memAllocator

    Reference to LogMemoryManager holding memory buffers for the passed in message.

    Returns
    Type Description
    int

    messageOutput length or negative number if an error occurred.

    Remarks

    This method is called by a TextLogger Sinks to extract the data from the message and generate a formatted text string, which can be written to an output stream. The message output is returned through a UnsafeText variable while any error messages are returned through a separate FixedString variable.

    The returned message string is allocated internally according to the size/length of the message, and therefore the caller should pass in an empty messageOutput variable. Furthermore, the string memory is allocated from the Temp pool and must not be referenced after the end of the frame. If the message needs to be held longer, it must be copied to a Persistent buffer. The caller should still Dispose the string once it's finished with it.

    If a problem occurs parsing/writing the output text, a separate errorMessage string is returned; a value of 'false' is returned in this case. Otherwise errorMessage string will be empty and 'true' is returned. Note that messageOutput may still hold valid text even if a error/failure occurs; it'll be a "partial" output string and missing some or all of the data.

    The caller must also pass in a reference to the LogMemoryManager instance holding the backing memory for the passed in LogMessage. Generally this is the MemoryManager within the Logger the Sink resides in.

    In This Article
    Back to top
    Copyright © 2023 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)