Create general purpose logging module #4

Merged
ehrumsey merged 15 commits from dev-logging into dev 2025-03-11 20:31:37 -05:00
Owner

Can be called anywhere within JMC codebase. Built on a @lazy function logger() that takes in log type, caller, and message. Output a string passed to the say command.

Configure five log levels, called using their associated integer:

  • 5 – FATAL
  • 4 – ERROR
  • 3 – WARNING
  • 2 – INFO
  • 1 – DEBUG

Add log level, which sets default log output threshold to 3 (WARNING). Allow log level to be changed by modifying the codebase or setting manually via scoreboard value. Prevent log level from being automatically reset on reload unless presenting an invalid value.

Add toggleable debug mode that bypasses configured log level when enabled. Prevent reload from changing value when already set.

Implement "caller" parameter to allow for tracing of bugs. There is no automatic caller detection, so the field should be filled out according to a set of conventions. Current suggestion is:

namespace:path/to/function

Prefer say over tellraw as it will always send regardless of players online. This allows for logging-based development without loading the client. It should also allow logs to be sent to chat when appropriate, but this has not worked with the current Discord integration.

Can be called anywhere within JMC codebase. Built on a @lazy function `logger()` that takes in log type, caller, and message. Output a string passed to the `say` command. Configure five log levels, called using their associated integer: - 5 – FATAL - 4 – ERROR - 3 – WARNING - 2 – INFO - 1 – DEBUG Add log level, which sets default log output threshold to 3 (WARNING). Allow log level to be changed by modifying the codebase or setting manually via scoreboard value. Prevent log level from being automatically reset on `reload` unless presenting an invalid value. Add toggleable debug mode that bypasses configured log level when enabled. Prevent `reload` from changing value when already set. Implement "caller" parameter to allow for tracing of bugs. There is no automatic caller detection, so the field should be filled out according to a set of conventions. Current suggestion is: ``` namespace:path/to/function ``` Prefer `say` over `tellraw` as it will always send regardless of players online. This allows for logging-based development without loading the client. It should also allow logs to be sent to chat when appropriate, but this has not worked with the current Discord integration.
ehrumsey added 15 commits 2025-03-11 20:21:29 -05:00
ehrumsey changed title from Create general purpose logging module to [WIP] Create general purpose logging module 2025-03-11 20:23:02 -05:00
ehrumsey added the
Kind/Feature
Priority
High
Reviewed
Confirmed
labels 2025-03-11 20:30:54 -05:00
ehrumsey changed title from [WIP] Create general purpose logging module to Create general purpose logging module 2025-03-11 20:31:14 -05:00
ehrumsey merged commit 6cb4b30b2d into dev 2025-03-11 20:31:37 -05:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: ferdinland-minecraft-server/smp-datapack#4
No description provided.