From 3938e5c0c86adbac9949bef13d1dd2d9c076b9e7 Mon Sep 17 00:00:00 2001 From: George Kaklamanos Date: Thu, 30 Nov 2023 20:50:26 +0200 Subject: [PATCH] common: Add helper function for running logging command --- labadoor-common/src/lib.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/labadoor-common/src/lib.rs b/labadoor-common/src/lib.rs index fff1cca..e35ed42 100644 --- a/labadoor-common/src/lib.rs +++ b/labadoor-common/src/lib.rs @@ -7,6 +7,13 @@ pub struct OpenBinaryArgs { pub resource_shortcut: i8, } +pub struct LogBinaryArgs { + pub time: String, + pub method: String, + pub identifier: String, + pub resource: String, +} + pub fn run_bin(bin: Binary) -> BinaryResult { use std::{ io::Read, @@ -36,3 +43,12 @@ pub fn run_open(args: OpenBinaryArgs, bin: Binary) -> BinaryResult { auth_bin.push(args.resource_shortcut.to_string()); run_bin(auth_bin) } + +pub fn run_log(args: LogBinaryArgs, bin: Binary) -> BinaryResult { + let mut auth_bin = bin.clone(); + auth_bin.push(args.time.clone()); + auth_bin.push(args.method.clone()); + auth_bin.push(args.identifier.clone()); + auth_bin.push(args.resource.clone()); + run_bin(auth_bin) +}