Logging + config tweaks

This commit is contained in:
2026-03-10 09:13:37 -07:00
parent 6889edef0c
commit c02e92dd72
3 changed files with 14 additions and 25 deletions

View File

@@ -99,7 +99,7 @@ pub struct FieldSpec {
pub r#type: FieldType, pub r#type: FieldType,
/// How to find this field in a data entry /// How to find this field in a data entry
pub path: OneOrMany<ObjectPath>, pub path: Vec<ObjectPath>,
/// How to post-process this field /// How to post-process this field
#[serde(default)] #[serde(default)]

View File

@@ -1,33 +1,9 @@
use core::slice;
use std::fmt::{Debug, Display}; use std::fmt::{Debug, Display};
use std::ops::Deref; use std::ops::Deref;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use smartstring::{LazyCompact, SmartString}; use smartstring::{LazyCompact, SmartString};
#[derive(Debug, Clone, Deserialize)]
#[serde(untagged)]
pub enum OneOrMany<T: Debug + Clone> {
One(T),
Many(Vec<T>),
}
impl<T: Debug + Clone> OneOrMany<T> {
pub fn to_vec(self) -> Vec<T> {
match self {
Self::One(x) => vec![x],
Self::Many(x) => x,
}
}
pub fn as_slice(&self) -> &[T] {
match self {
Self::One(x) => slice::from_ref(x),
Self::Many(x) => &x[..],
}
}
}
// //
// MARK: Label // MARK: Label
// //

View File

@@ -37,6 +37,8 @@ pub enum LoggingPreset {
pub struct LoggingConfig { pub struct LoggingConfig {
other: LogLevel, other: LogLevel,
extractor: LogLevel,
pile: LogLevel, pile: LogLevel,
pile_flac: LogLevel, pile_flac: LogLevel,
pile_config: LogLevel, pile_config: LogLevel,
@@ -53,7 +55,13 @@ impl From<LoggingConfig> for EnvFilter {
// Fixed sources // Fixed sources
format!("html5ever={}", LogLevel::Error), format!("html5ever={}", LogLevel::Error),
format!("tantivy={}", LogLevel::Error), format!("tantivy={}", LogLevel::Error),
format!("aws_smithy_runtime={}", LogLevel::Error),
format!("aws_smithy_http_client={}", LogLevel::Error),
format!("aws_sdk_s3={}", LogLevel::Error),
format!("aws_sigv4={}", LogLevel::Error),
format!("hyper_util={}", LogLevel::Error),
// Configurable sources // Configurable sources
format!("pdf={}", conf.extractor),
format!("pile={}", conf.pile), format!("pile={}", conf.pile),
format!("pile_flac={}", conf.pile_flac), format!("pile_flac={}", conf.pile_flac),
format!("pile_config={}", conf.pile_config), format!("pile_config={}", conf.pile_config),
@@ -78,6 +86,7 @@ impl LoggingPreset {
match self { match self {
Self::Error => LoggingConfig { Self::Error => LoggingConfig {
other: LogLevel::Error, other: LogLevel::Error,
extractor: LogLevel::Error,
pile: LogLevel::Error, pile: LogLevel::Error,
pile_flac: LogLevel::Error, pile_flac: LogLevel::Error,
@@ -88,6 +97,7 @@ impl LoggingPreset {
Self::Warn => LoggingConfig { Self::Warn => LoggingConfig {
other: LogLevel::Error, other: LogLevel::Error,
extractor: LogLevel::Error,
pile: LogLevel::Warn, pile: LogLevel::Warn,
pile_flac: LogLevel::Warn, pile_flac: LogLevel::Warn,
@@ -98,6 +108,7 @@ impl LoggingPreset {
Self::Info => LoggingConfig { Self::Info => LoggingConfig {
other: LogLevel::Warn, other: LogLevel::Warn,
extractor: LogLevel::Error,
pile: LogLevel::Info, pile: LogLevel::Info,
pile_flac: LogLevel::Info, pile_flac: LogLevel::Info,
@@ -108,6 +119,7 @@ impl LoggingPreset {
Self::Debug => LoggingConfig { Self::Debug => LoggingConfig {
other: LogLevel::Warn, other: LogLevel::Warn,
extractor: LogLevel::Error,
pile: LogLevel::Debug, pile: LogLevel::Debug,
pile_flac: LogLevel::Debug, pile_flac: LogLevel::Debug,
@@ -118,6 +130,7 @@ impl LoggingPreset {
Self::Trace => LoggingConfig { Self::Trace => LoggingConfig {
other: LogLevel::Trace, other: LogLevel::Trace,
extractor: LogLevel::Error,
pile: LogLevel::Trace, pile: LogLevel::Trace,
pile_flac: LogLevel::Trace, pile_flac: LogLevel::Trace,