Only print logs from the registry, add some debug info to pulling blobs

This commit is contained in:
SeanOMik 2023-07-22 01:34:41 -04:00
parent 83d0e61fde
commit 5a0cdd271f
Signed by: SeanOMik
GPG Key ID: 568F326C7EB33ACB
3 changed files with 23 additions and 3 deletions

View File

@ -56,6 +56,8 @@ pub async fn pull_digest_get(Path((_name, layer_digest)): Path<(String, String)>
// convert the `Stream` into an `axum::body::HttpBody`
let body = StreamBody::new(stream);
debug!("length of range request: {}", starting - ending);
Ok((
StatusCode::OK,
[
@ -71,6 +73,8 @@ pub async fn pull_digest_get(Path((_name, layer_digest)): Path<(String, String)>
// convert the `Stream` into an `axum::body::HttpBody`
let body = StreamBody::new(stream);
debug!("length of streamed request: {}", len);
Ok((
StatusCode::OK,
[

View File

@ -64,6 +64,8 @@ pub struct Config {
pub listen_address: String,
pub listen_port: String,
url: Option<String>,
#[serde(default)]
pub extra_logging: bool,
#[serde(deserialize_with = "serialize_log_level", default = "default_log_level")]
pub log_level: Level,
pub ldap: Option<LdapConnectionConfig>,

View File

@ -32,6 +32,8 @@ use tracing::{debug, info};
use app_state::AppState;
use database::Database;
use tracing_subscriber::filter;
use tracing_subscriber::{filter::FilterFn, layer::{Layer as TracingLayer, SubscriberExt}, util::SubscriberInitExt,};
use crate::storage::StorageDriver;
use crate::storage::filesystem::FilesystemDriver;
@ -72,9 +74,21 @@ async fn main() -> anyhow::Result<()> {
let mut config = Config::new()
.expect("Failure to parse config!");
tracing_subscriber::fmt()
.with_max_level(config.log_level)
.init();
// Create a tracing subscriber
if !config.extra_logging {
// only allow logs from the registry
tracing_subscriber::registry()
.with(tracing_subscriber::fmt::layer())
.with(filter::Targets::new()
.with_target("orca_registry", config.log_level)
)
.init();
} else {
// allow all logs from any crates
tracing_subscriber::fmt()
.with_max_level(config.log_level)
.init();
}
let sqlite_config = match &config.database {
DatabaseConfig::Sqlite(sqlite) => sqlite,