Skip to content

feat: replace log with tracing#1460

Merged
Purdze merged 14 commits intoPumpkin-MC:masterfrom
FabseGP:tracing
Feb 13, 2026
Merged

feat: replace log with tracing#1460
Purdze merged 14 commits intoPumpkin-MC:masterfrom
FabseGP:tracing

Conversation

@FabseGP
Copy link
Contributor

@FabseGP FabseGP commented Feb 7, 2026

Description

Replace all instances of log with tracing

Testing

WIP

@FabseGP
Copy link
Contributor Author

FabseGP commented Feb 8, 2026

Since the global tracing-subscriber doesn't spawn to any threads spawned (post for context), each plugin spawns their own tracing_subscriber and calls a log-function from the plugin context instead of log! directly. The output will look like this:

2026-02-08 17:51:49  INFO ThreadId(13) pumpkin_plugin: Hello! plugin="hello-pumpkin"

with "hello-plugin" being the name of the plugin

@FabseGP FabseGP marked this pull request as ready for review February 8, 2026 17:50
Copy link
Contributor

@BjornTheProgrammer BjornTheProgrammer left a comment

Choose a reason for hiding this comment

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

A lot of great work here! Just a few questions before this can be merged.

match self {
Self::Console => log::info!("{}", text.to_pretty_console()),
#[allow(clippy::print_stdout)]
Self::Console => println!("{}", text.to_pretty_console()),
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the reason as to using a println instead of a tracing::info?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh that was before #1516 got merged (downgrading tracing-subscriber to a version which didn't escape ANSI-characters), but I'm not sure if I want to revert this

The argument for escaping ANSI-characters by the project was for security and for commands run by users in the console, they prob don't need the extra info from tracing

}
}

pub fn log(&self, message: impl std::fmt::Display) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to not use a macro instead? It's a little annoying to have to do server.log(format!(...)). Additionally maybe we shouldn't even have this since logging directly in the plugin using tracing or log seems to work just fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True that will be tedious, I'll try and create a macro a bit later!

Regarding the last point, I think we should consolidate as many methods a plugin might use within Pumpkin itself, standardizing logs and whatever other functionality in the future (say log rate limiting or an api for getting the logs)

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, I understand the rational, but I'll wait for Alex's input on this. It might be a week before we can get this merged!

Copy link
Contributor

Choose a reason for hiding this comment

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

We've decided that this is actually fine.

@BjornTheProgrammer
Copy link
Contributor

Forgot to mention it here, but I have run it on a simple plugin, and it seems to work perfectly in my testing. Great work!

@FabseGP
Copy link
Contributor Author

FabseGP commented Feb 11, 2026

I wonder too if we should consider adding a step in the CI to compile the Hello-Pumpkin plugin as a way to detect breakages with plugins (like with how it's broken now because CommandExecute now expects an integer on return)

Not in this pr, but a new one if useful?

@BjornTheProgrammer
Copy link
Contributor

I've actually tried to do the same thing in the past, but it wasn't merged. Alex wants to keep all plugins in the separate repo. Even if it is for testing, if I remember correctly.

@FabseGP
Copy link
Contributor Author

FabseGP commented Feb 11, 2026

I've actually tried to do the same thing in the past, but it wasn't merged. Alex wants to keep all plugins in the separate repo. Even if it is for testing, if I remember correctly.

Oh that can work still like in #1530, we can just point to the repository using the checkout action

EDIT: it'll fail now because the plugin is currently broken

Copy link
Contributor

@Purdze Purdze left a comment

Choose a reason for hiding this comment

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

if we're using tracking we should use something like (info!(player = %name, "conneted"))

that can be done in a seperate pr though, leave a todo mentioning this and ill merge

@FabseGP
Copy link
Contributor Author

FabseGP commented Feb 12, 2026

if we're using tracking we should use something like (info!(player = %name, "conneted"))

That's a good idea, there are prob other places as well where structured logging would make sense! I'll look through later, for now the todo is added

@Purdze Purdze merged commit 24ea53b into Pumpkin-MC:master Feb 13, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants