summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-06-26 15:00:07 -0600
committermo khan <mo@mokhan.ca>2025-06-26 15:00:07 -0600
commit91a989b761f97a70e76031988cf570ad5d209f47 (patch)
tree2490390f6b6309d868d9d7def2fbe764e9e15fbf /src
parent73688038a35d0ceee3d45bd15825a38bb26e74c0 (diff)
chore: add minimal basic logging
Diffstat (limited to 'src')
-rw-r--r--src/authorization/check_service.rs2
-rw-r--r--src/main.rs4
2 files changed, 5 insertions, 1 deletions
diff --git a/src/authorization/check_service.rs b/src/authorization/check_service.rs
index a65d8d95..d2dd1e17 100644
--- a/src/authorization/check_service.rs
+++ b/src/authorization/check_service.rs
@@ -25,8 +25,10 @@ impl envoy_types::ext_authz::v3::pb::Authorization for CheckService {
let request = request.into_inner();
if dbg!(self.authorizer.authorize(dbg!(request))) {
+ log::info!("OK");
Ok(Response::new(CheckResponse::with_status(Status::ok("OK"))))
} else {
+ log::info!("Unoauthorized");
Ok(Response::new(CheckResponse::with_status(
Status::unauthenticated("Unauthorized"),
)))
diff --git a/src/main.rs b/src/main.rs
index 0a1cd5a5..d847a2ee 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -6,6 +6,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
use std::sync::Arc;
use tonic::transport::Server;
+ tracing_subscriber::fmt().json().init();
+
let addr = std::env::var("BIND_ADDR")
.unwrap_or_else(|_| "[::1]:50051".to_string())
.parse()?;
@@ -25,7 +27,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.unwrap(),
);
- println!("Listening on... {addr}");
+ log::info!("Listening on... {addr}");
server.serve(addr).await?;
Ok(())