Skip to content

Conversation

@alocay
Copy link
Contributor

@alocay alocay commented Oct 21, 2025

Adding configuration options for logging output format. The available options are full (default), compact, json, and pretty.

logging:
  level: info
  format: compact

@apollo-librarian
Copy link

apollo-librarian bot commented Oct 21, 2025

✅ Docs preview ready

The preview is ready to be viewed. View the preview

File Changes

0 new, 1 changed, 0 removed
* (developer-tools)/apollo-mcp-server/(latest)/config-file.mdx

Build ID: 1b239b85ab6b3404101b79f7
Build Logs: View logs

URL: https://www.apollographql.com/docs/deploy-preview/1b239b85ab6b3404101b79f7

@alocay alocay changed the base branch from main to air-39-configure-otel-metadata-headers October 21, 2025 16:38
Copy link
Contributor

@nicholascioli nicholascioli left a comment

Choose a reason for hiding this comment

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

I just realized this is still in draft. Feel free to ignore most of these!

use tracing_subscriber::EnvFilter;
use tracing_subscriber::fmt::Layer;
use tracing_subscriber::fmt::writer::BoxMakeWriter;
use tracing_subscriber::{EnvFilter, Layer as LayerTrait, Registry};
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: This should be split up like the other imports.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you clarify why?

Base automatically changed from air-39-configure-otel-metadata-headers to develop October 22, 2025 14:20
@alocay alocay force-pushed the provide-more-log-format-options branch from 768b10c to 87886f7 Compare October 22, 2025 14:22
@alocay alocay marked this pull request as ready for review October 22, 2025 19:00
@alocay alocay requested review from a team as code owners October 22, 2025 19:00
.with_writer(writer)
.with_ansi(self.ansi_enabled)
.with_target(false)
.boxed(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nicholascioli is there a cleaner way of doing this? Since full, compact, json, and pretty all return a different type I could not figure out how to return from this match block without erasing the type (calling boxed). Let me know if there is a better way.

@alocay alocay requested a review from nicholascioli October 22, 2025 19:12
Copy link
Contributor

@DaleSeo DaleSeo left a comment

Choose a reason for hiding this comment

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

Nice work! Just small suggestions.

impl Logging {
pub fn env_filter(logging: &Logging) -> Result<EnvFilter, anyhow::Error> {
let mut env_filter = EnvFilter::from_default_env().add_directive(logging.level.into());
pub struct LoggingLayerBuilder {
Copy link
Contributor

Choose a reason for hiding this comment

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

We can derive Default for LoggingLayerBuilder instead of manually implementing it, which is more idiomatic:

If we add it here,

Suggested change
pub struct LoggingLayerBuilder {
#[derive(Default)]
pub struct LoggingLayerBuilder {

L69 will look like this:

impl LoggingLayerBuilder {
    pub fn new() -> Self {
        Self::default()
    }
}

Comment on lines +78 to +80
// This primarily to be used by unit tests to allow for dependency injection.
// If no writer is provided when build() is called, one will be created using the logging config options.
#[allow(dead_code)]
Copy link
Contributor

Choose a reason for hiding this comment

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

Adding production code just for tests isn't ideal. How about only compiling these methods during tests?

Suggested change
// This primarily to be used by unit tests to allow for dependency injection.
// If no writer is provided when build() is called, one will be created using the logging config options.
#[allow(dead_code)]
#[cfg(test)]

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.

5 participants