Log Message won't work for one mod - RESOLVED

Started by Cozarkian, January 08, 2021, 02:29:20 PM

Previous topic - Next topic

Cozarkian

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.


RawCode

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

Canute

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 ! :-)

SeminarCaviar

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.

RawCode

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

Canute

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.