Skip to content

Conversation

dknopik
Copy link
Member

@dknopik dknopik commented Jul 18, 2025

Proposed Changes

  • Move more logging related logic to the logging crate
  • Logging crate had a logging module which was completely reexported. Define items in crate root instead.
  • Keep guards unified and separate from logging layers.
  • Create discv5 and libp2p layers only once.
  • Implement compression of discv5 and libp2p layers

Additional Info

This was originally part of #347

@dknopik dknopik added the ready-for-review This PR is ready to be reviewed label Jul 22, 2025
Copy link

mergify bot commented Jul 23, 2025

This pull request has merge conflicts. Could you please resolve them @dknopik? 🙏

@mergify mergify bot added waiting-on-author and removed ready-for-review This PR is ready to be reviewed labels Jul 23, 2025
# Conflicts:
#	anchor/logging/src/tracing_libp2p_discv5_layer.rs
@mergify mergify bot added ready-for-review This PR is ready to be reviewed and removed waiting-on-author labels Jul 23, 2025
};

let _guards = match enable_logging(file_logging_flags, &global_config) {
let _guards = match logging::enable_logging(file_logging_flags, &global_config) {
Copy link
Member

Choose a reason for hiding this comment

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

Why is it not used?

@diegomrsantos diegomrsantos requested a review from Copilot August 11, 2025 11:20
Copy link

mergify bot commented Aug 11, 2025

This pull request has merge conflicts. Could you please resolve them @dknopik? 🙏

@mergify mergify bot added waiting-on-author and removed ready-for-review This PR is ready to be reviewed labels Aug 11, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the logging setup by moving logging logic from the main application to the logging crate for better organization and consolidation.

  • Consolidates logging setup code in the logging crate by moving enable_logging function from main.rs
  • Simplifies the module structure by defining items in the crate root instead of a separate logging module
  • Improves guard management by keeping guards unified and separate from logging layers

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
anchor/src/main.rs Removes logging setup code and imports, delegates to logging crate
anchor/logging/src/lib.rs Adds consolidated logging setup functions and FileLoggingFlags definition
anchor/logging/src/logging.rs File deleted - contents moved to lib.rs
anchor/logging/src/tracing_libp2p_discv5_layer.rs Updates layer creation with compression support and better error handling
anchor/logging/Cargo.toml Adds global_config dependency
Comments suppressed due to low confidence (1)

anchor/logging/src/tracing_libp2p_discv5_layer.rs:93

  • The parameter config has been renamed to logging_config in the function signature but the implementation still references config. This inconsistency could lead to confusion during maintenance.
        .map_err(|e| format!("Failed to initialize discv5 rolling file appender: {e}"))?;


pub fn init_file_logging(
logs_dir: &Path,
config: &FileLoggingFlags,
Copy link

Copilot AI Aug 11, 2025

Choose a reason for hiding this comment

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

The function signature change from config: FileLoggingFlags (by value) to config: &FileLoggingFlags (by reference) is a breaking change that could affect existing callers expecting to pass the struct by value.

Suggested change
config: &FileLoggingFlags,
config: FileLoggingFlags,

Copilot uses AI. Check for mistakes.

config: &FileLoggingFlags,
) -> Result<Option<LoggingLayer>, String> {
if config.disabled_file_logging() {
return Ok(None);
Copy link

Copilot AI Aug 11, 2025

Choose a reason for hiding this comment

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

The return type has changed from Option<LoggingLayer> to Result<Option<LoggingLayer>, String>, which is a breaking change. Existing callers that expect an Option will need to be updated to handle the Result.

Suggested change
return Ok(None);
) -> Option<LoggingLayer> {
if config.disabled_file_logging() {
return None;

Copilot uses AI. Check for mistakes.

@mergify mergify bot closed this Sep 12, 2025
Copy link

mergify bot commented Sep 12, 2025

Hi @dknopik, this pull request has been closed automatically due to 30 days of inactivity. If you’d like to continue working on it, feel free to reopen at any time.

@mergify mergify bot added the stale label Sep 12, 2025
@dknopik
Copy link
Member Author

dknopik commented Sep 12, 2025

rude

@dknopik dknopik reopened this Sep 12, 2025
@dknopik dknopik added ready-for-review This PR is ready to be reviewed and removed stale waiting-on-author labels Sep 12, 2025
# Conflicts:
#	anchor/logging/src/logging.rs
#	anchor/src/main.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review This PR is ready to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants