mirror of
https://gitlab.com/fabinfra/fabaccess/bffh.git
synced 2025-06-11 10:53:19 +02:00
log all api calls with TRACE
level
This commit is contained in:
@ -3,6 +3,7 @@ use crate::authorization::roles::Roles;
|
||||
use crate::resources::Resource;
|
||||
use crate::users::{db, UserRef};
|
||||
use crate::Users;
|
||||
use tracing::Span;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct SessionManager {
|
||||
@ -19,8 +20,14 @@ impl SessionManager {
|
||||
pub fn open(&self, uid: impl AsRef<str>) -> Option<SessionHandle> {
|
||||
let uid = uid.as_ref();
|
||||
if let Some(user) = self.users.get_user(uid) {
|
||||
tracing::trace!(uid, ?user, "opening new session for user");
|
||||
let span = tracing::info_span!(
|
||||
target: "bffh::api",
|
||||
"session",
|
||||
uid = uid,
|
||||
);
|
||||
tracing::trace!(parent: &span, uid, ?user, "opening session");
|
||||
Some(SessionHandle {
|
||||
span,
|
||||
users: self.users.clone(),
|
||||
roles: self.roles.clone(),
|
||||
user: UserRef::new(user.id),
|
||||
@ -33,6 +40,8 @@ impl SessionManager {
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct SessionHandle {
|
||||
pub span: Span,
|
||||
|
||||
pub users: Users,
|
||||
pub roles: Roles,
|
||||
|
||||
|
Reference in New Issue
Block a user