UnofficialCrusaderPatch / UnofficialCrusaderPatch3

Development for the dll Injection approach
GNU General Public License v3.0
12 stars 2 forks source link

Make a log folder and have dedicated logs for each extension #46

Open gynt opened 1 year ago

gynt commented 1 year ago

ucp/log/aicloader-0.0.1 for example

TheRedDaemon commented 1 year ago

Should this be an extension of the general logging API, both for Lua and Machine Code?
Do you already have an idea how to get the information which module logged and which dll?

I assume the later could be more complicated. At least, the ways I found that could find out the calling dll via code looked like debugging APIs and I am not sure how efficient they are. While a bit more efficient, I do not know if getting the dll the first time and then only checking for the calling address would be truly the better way.
Maybe the logging could be initialized before a handle is received, or the log function could be extened to always require the needed information (in the end, at least module and dll name would always be const strings)?

gynt commented 1 year ago

The main idea behind this is that browsing through a log file to look for what module X said is quite inconvenient, but maybe I am complaining about something which is quite normal.

Let's strip the version info from the log folder and do something like:

log(whoAmI, logLevel, msg) with whoAmI being the extension name you are. These names are supposed to be unique. If you are a dll, maybe: module-name-dll?

TheRedDaemon commented 1 year ago

Hm, a module could in theory load multiple dlls. Maybe offer three versions?:

I think that would be mostly for the machine code part. Isn't the log for the lua part already modified to include the module?

gynt commented 1 year ago

yes the lua log function already knows which module is calling it :), but I think I did that for print and not log haha... but if logs need to go into different files, the ucp.dll already needs to receive the information which module it is from.

I am putting this as low priority.