Ludeon Forums

RimWorld => Mods => Help => Topic started by: Cozarkian on January 08, 2021, 02:29:20 PM

Title: Log Message won't work for one mod - RESOLVED
Post by: Cozarkian on January 08, 2021, 02:29:20 PM
Edit: Problem Resolved, thanks to those that helped.

Does anyone have an idea why one of my mods won't display log messages anymore? For example, with the following code structure (substituting the name), the settings populate, the harmony patch runs, the patched methods work properly, but the log message doesn't work.


        public Mod_Name(ModContentPack content) : base(content)
        {
            GetSettings<ModSettings_Name>();
            Harmony harmony = new Harmony("rimworld.modname");
            harmony.PatchAll(Assembly.GetExecutingAssembly());
            Log.Message("Mod Name Patched");
            //Harmony.DEBUG = true;
        }


The same code structure works for my other mods.

Title: Re: Log Message won't work for one mod
Post by: RawCode on January 09, 2021, 11:32:50 AM
code is not some "black box" and if something not working or working not as intended, there are always reasons

public static void Message(string text)
{
bool flag = Log.ReachedMaxMessagesLimit;
if (!flag)
{
Debug.Log(text);
Log.messageQueue.Enqueue(new LogMessage(LogMessageType.Message, text, StackTraceUtility.ExtractStackTrace()));
Log.PostMessage();
}
}


as you can see, there is special flag ReachedMaxMessagesLimit that used to disable messages, limit is 1000 records, this counts everything, including messages you do not see.

try using logging methods directly or calling ResetMessageCount
Title: Re: Log Message won't work for one mod
Post by: Canute on January 09, 2021, 11:59:41 AM
But don't forget to remove it later, or you will have ultra large log files.
And maybe add your modname to the message, so someone else can identify later if you forget them ! :-)
Title: Re: Log Message won't work for one mod
Post by: SeminarCaviar on January 12, 2021, 10:42:02 PM
Quote from: Canute on January 09, 2021, 11:59:41 AM
But don't forget to remove it later, or you will have ultra large log files.
And maybe add your modname to the message, so someone else can identify later if you forget them ! :-)
I agree, having large log files isn't good.
Title: Re: Log Message won't work for one mod
Post by: RawCode on January 13, 2021, 05:50:41 AM
with ssd's over 1tb affordable and 14tb mechanical drives and file systems with driver or ever firmware compression?

ever multiple gigabyte logfiles is not an issue, game keep only two logs at most.

when i hosted minecraft server, i never touched logs, multiple years worth of logs was below gb
Title: Re: Log Message won't work for one mod
Post by: Canute on January 13, 2021, 10:34:57 AM
But not everyone got such SSD's.
Rimworld is a game that people like to play even at older mashines. And then 2 logfiles with gb size could shrink their appdata location at a hard way.
At last only very few mods have such a log spam.
And regular logfile's arn't that big anyway so you can keep them over years.