NQualityOfLife.XML.Log - Niilo007/RimWorld-NQoL GitHub Wiki

Log

Related:


XML

<Operation Class="NQualityOfLife.XML.Log">
    <text>string<text>
    <message>string<message>
    <warning>string<warning>
    <errorMessage>string<errorMessage>
    <xpath>string</xpath>
    <debug>bool<debug> <!-- false -->
    <done Class="PatchOperation"> <!-- Optional -->

    </done>
    <error Class="PatchOperation"> <!-- Optional -->

    </error>
</Operation>

Usage

Currently only intended to be used to log NQoL related messages, and does not support other mods using it.

The string nodes support the variable system as long as the input is only and exactly the variable name.


<text>

Log a message with this text.
Supports variables.


<message>

Log a message with this text.
Supports variables.


<warning>

Log a warning with this text.
Supports variables.


<errorMessage>

Log an error with this text.
Supports variables.


<xpath>

Supports variables.


<applyVariables>

Apply variables to the log message?


<toVar>

The xpath gets stored in this variable if provided.


<count>

tba


<debug>

When true, only print in NQoL debug mode.


<done>

The patch operation to perform when this one has completed successfully.


<error>

The patch operation to perform if this one fails or errors.


Formatting

Special Formatting Rules

The first instance of "NQoL" is always colorized and or added if it was not in the input text.
All instances of the string "Niilo's QoL" are colored with the specified NQoL identifier color.
Text inside ( & ) is colored with -> Utils.Log.Colors.Method_Quote_3_Color
And text inside ' & ' is colored with -> Utils.Log.Colors.Method_Quote_2_Color and Utils.Log.Colors.Method_Quote_1_Color_Tag if multiple.
All instances of "'False'", "'false'", "'True'" & "'true'" are colored with red or green respectively.

Special Formatting Symbols

The first instance of this: "###" string is turned to -> <color={Utils.Log.Colors.ModWarning_OtherMod_2_Color_Value}>
Any subsequent instances of: "###" are then turned to -> <color={Utils.Log.Colors.ModWarning_OtherMod_Color_Value}>
All instanced of: "##" are turned to -> </color>


Errors


Examples

Used In Example:

<Operation Class="NQualityOfLife.XML.AddOrReplaceIfExists">
    <xpath>
        Defs/ResearchProjectDef
        [defName[contains(text(),"Net")]]
        [defName[contains(text(),"Fish")]]
        [not(defName="NQoL_Trapping_Research")]
    </xpath>
    <value>
        <researchViewX>2.00</researchViewX>
        <researchViewY>4.80</researchViewY>
    </value>
    <doesNotExist Class="NQualityOfLife.XML.Log">
        <warning>Did not find any fish trap researches to patch!</warning>
        <debug>true</debug>
    </doesNotExist>
</Operation>

Used In Example:

<Operation Class="NQualityOfLife.XML.PatchIfExists">
    <xpath>Defs/ResearchProjectDef[label[contains(text(),"gunsmithing")] or defName="Gunsmithing"]/prerequisites/li[text()="Machining"]</xpath>
    <exists Class="PatchOperationRemove">
        <xpath>Defs/ResearchProjectDef[label[contains(text(),"gunsmithing")] or defName="Gunsmithing"]/prerequisites/li[text()="Machining"]</xpath>
    </exists>
    <doesNotExist Class="NQualityOfLife.XML.Log">
        <warning>Tried to remove 'Machining' from the 'prerequisites' of 'Gunsmithing' but it was not there! A conflicting research overhaul mod may be active.</warning>
    </doesNotExist>
</Operation>

⚠️ **GitHub.com Fallback** ⚠️