about summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
authorArun Isaac2025-08-17 23:04:25 +0100
committerArun Isaac2025-08-18 14:40:40 +0100
commit41a9337ea81e418635cfe279a0ebe83307a0e822 (patch)
tree8b654007018dae435bb42eae882def32fee30bf2 /bin
parent2e488b15f383aff1a6a020597ecc3fe284c43077 (diff)
downloadravanan-41a9337ea81e418635cfe279a0ebe83307a0e822.tar.gz
ravanan-41a9337ea81e418635cfe279a0ebe83307a0e822.tar.lz
ravanan-41a9337ea81e418635cfe279a0ebe83307a0e822.zip
bin: Allow controlling log level via --log-level.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ravanan15
1 files changed, 14 insertions, 1 deletions
diff --git a/bin/ravanan b/bin/ravanan
index ba04718..ff92487 100755
--- a/bin/ravanan
+++ b/bin/ravanan
@@ -81,6 +81,14 @@ exec guile --no-auto-compile -e main -s "$0" "$@"
                 (lambda (opt name arg result)
                   (acons 'outdir arg
                          result)))
+        (option (list "log-level") #t #f
+                (lambda (opt name arg result)
+                  (let ((accepted-values (list "debug" "info" "warning"
+                                               "error" "critical")))
+                    (if (member (string-downcase arg) accepted-values)
+                        (acons 'log-level (string->symbol (string-downcase arg))
+                               result)
+                        (user-error "Unknown log level ~a" arg)))))
         (option (list "trace") #t #f
                 (lambda (opt name arg result)
                   (let ((accepted-values (list "slurm-api")))
@@ -137,6 +145,9 @@ Slurm API batch system options:
 
 Debugging options:
 
+  --log-level=LEVEL              log messages with higher severity than LEVEL
+                                 (accepted values: debug, info, warning,
+                                                   error, critical)
   --trace=SUBSYSTEM              enable tracing on subsystem;
                                  repeat to trace multiple subsystems
                                  (accepted values: slurm-api)
@@ -208,6 +219,7 @@ files that have the token in the @verbatim{SLURM_JWT=token} format."
                               (slurm-api-endpoint . ,(build-uri 'http
                                                                 #:host "localhost"
                                                                 #:port 6820))
+                              (log-level . warning)
                               (traces . ())))))
        (when (assq-ref args 'help)
          (print-usage program)
@@ -254,7 +266,8 @@ files that have the token in the @verbatim{SLURM_JWT=token} format."
                                          (user-error "Error loading manifest file ~a"
                                                      file)
                                          (raise-exception c))))))
-                            (parameterize ((%traces (assq-ref args 'traces)))
+                            (parameterize ((%log-level (assq-ref args 'log-level))
+                                           (%traces (assq-ref args 'traces)))
                               (run-workflow (file-name-stem workflow-file)
                                             (and (assq 'guix-manifest-file args)
                                                  (canonicalize-path