Skip to content

Commit 65bf25e

Browse files
committed
ログをもうちょい細かくする
1 parent 351c02f commit 65bf25e

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

feline/src/jail.rs

+15-3
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,11 @@ pub async fn prepare_environment(
402402
.output()
403403
.await?;
404404
if !uid.status.success() {
405-
return Err(anyhow::anyhow!("Failed to get uid"));
405+
return Err(anyhow::anyhow!(
406+
"Failed to get uid: status={}, base_dir={}",
407+
&uid.status,
408+
base_dir.to_str().unwrap_or(""),
409+
));
406410
}
407411
let uid: String = String::from_utf8(uid.stdout)?.trim().to_string();
408412
let gid: Output = Command::new("podman")
@@ -415,7 +419,11 @@ pub async fn prepare_environment(
415419
.output()
416420
.await?;
417421
if !gid.status.success() {
418-
return Err(anyhow::anyhow!("Failed to get gid"));
422+
return Err(anyhow::anyhow!(
423+
"Failed to get gid: status={}, base_dir={}",
424+
&gid.status,
425+
base_dir.to_str().unwrap_or(""),
426+
));
419427
}
420428
let gid: String = String::from_utf8(gid.stdout)?.trim().to_string();
421429
let r: Output = Command::new("podman")
@@ -427,7 +435,11 @@ pub async fn prepare_environment(
427435
.output()
428436
.await?;
429437
if !r.status.success() {
430-
return Err(anyhow::anyhow!("Failed to unshare"));
438+
return Err(anyhow::anyhow!(
439+
"Failed to unshare: status={}, base_dir={}",
440+
&r.status,
441+
base_dir.to_str().unwrap_or(""),
442+
));
431443
}
432444
Ok(base_dir)
433445
}

feline/src/main.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ struct Args {
6262

6363
#[tokio::main]
6464
async fn main() {
65-
env_logger::init();
65+
env_logger::builder().format_source_path(true).init();
6666

6767
let args: Args = Args::parse();
6868
let config: Config =
@@ -160,7 +160,10 @@ mod tests {
160160

161161
#[tokio::test]
162162
async fn test_logging_middleware() {
163-
let _ = env_logger::builder().is_test(true).try_init();
163+
let _ = env_logger::builder()
164+
.is_test(true)
165+
.format_source_path(true)
166+
.try_init();
164167

165168
let app: Router = Router::new()
166169
.route("/ok", get(ok_handler))

0 commit comments

Comments
 (0)