4de5fcdff8
Signed-off-by: Rodolfo Olivieri <rolivier@redhat.com> Signed-off-by: Douwe Osinga <douwe@squareup.com> Co-authored-by: Douwe Osinga <douwe@squareup.com>
18 lines
573 B
Rust
18 lines
573 B
Rust
use anyhow::Result;
|
|
use tracing_subscriber::util::SubscriberInitExt;
|
|
|
|
/// Sets up the logging infrastructure for the server.
|
|
/// Logs go to a JSON file and a pretty console layer on stderr.
|
|
pub fn setup_logging(name: Option<&str>) -> Result<()> {
|
|
let config = goose::logging::LoggingConfig {
|
|
component: "server",
|
|
name,
|
|
extra_directives: &["goose_server=info", "tower_http=info"],
|
|
console: true,
|
|
json: false,
|
|
};
|
|
let subscriber = goose::logging::build_logging_subscriber(&config)?;
|
|
subscriber.try_init()?;
|
|
Ok(())
|
|
}
|