mirror of
https://github.com/kjuulh/dagger-rs.git
synced 2025-07-26 03:19:21 +02:00
feat: add tracing logger
This commit is contained in:
@@ -7,14 +7,20 @@ use dagger_core::engine::Engine as DaggerEngine;
|
||||
|
||||
use crate::errors::ConnectError;
|
||||
use crate::gen::Query;
|
||||
use crate::logging::StdLogger;
|
||||
use crate::logging::{StdLogger, TracingLogger};
|
||||
use crate::querybuilder::query;
|
||||
|
||||
pub type DaggerConn = Arc<Query>;
|
||||
|
||||
pub async fn connect() -> Result<DaggerConn, ConnectError> {
|
||||
let cfg = if cfg!(feature = "otel") {
|
||||
let cfg = Config::new(None, None, None, None, Some(Arc::new(StdLogger::default())));
|
||||
let cfg = Config::new(
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
Some(Arc::new(TracingLogger::default())),
|
||||
);
|
||||
|
||||
#[cfg(feature = "otel")]
|
||||
crate::logging::otel_logging().map_err(ConnectError::FailedToInstallOtelTracer)?;
|
||||
|
@@ -61,13 +61,13 @@ impl Default for TracingLogger {
|
||||
|
||||
impl Logger for TracingLogger {
|
||||
fn stdout(&self, output: &str) -> eyre::Result<()> {
|
||||
tracing::info!(output = output, "dagger-sdk");
|
||||
tracing::info!(output = output, "dagger_sdk");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn stderr(&self, output: &str) -> eyre::Result<()> {
|
||||
tracing::warn!(output = output, "dagger-sdk");
|
||||
tracing::warn!(output = output, "dagger_sdk");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user