Skip to content
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.

debug log changes #39

Merged
merged 2 commits into from
May 10, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion NeosModLoader/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ internal static void DebugFuncInternal(Func<string> messageProducer)
}
}

internal static void DebugFuncExternal(Func<string> messageProducer)
internal static void DebugFuncExternal(Func<object> messageProducer)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably check if the output of messageProducer() is null and in that case also not log?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the output of messageProducer() is already being null-checked, and it logs the string "null"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So then DebugFuncExternal's output will always be logged. I guess it's a sensible option, just thought it might be neat to allow it to be used with potentially no output.

{
if (IsDebugEnabled())
{
Expand Down
2 changes: 1 addition & 1 deletion NeosModLoader/NeosMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace NeosModLoader
public abstract class NeosMod : NeosModBase
{
public static bool IsDebugEnabled() => Logger.IsDebugEnabled();
public static void DebugFunc(Func<string> messageProducer) => Logger.DebugFuncExternal(messageProducer);
public static void DebugFunc(Func<object> messageProducer) => Logger.DebugFuncExternal(messageProducer);
public static void Debug(string message) => Logger.DebugExternal(message); // needed for binary compatibility (REMOVE IN NEXT MAJOR VERSION)
public static void Debug(object message) => Logger.DebugExternal(message);
public static void Debug(params object[] messages) => Logger.DebugListExternal(messages);
Expand Down