Reduce logging noise
authorSiraaj Khandkar <siraaj@khandkar.net>
Fri, 26 Nov 2021 21:17:19 +0000 (16:17 -0500)
committerSiraaj Khandkar <siraaj@khandkar.net>
Fri, 26 Nov 2021 21:17:19 +0000 (16:17 -0500)
tt.rkt

diff --git a/tt.rkt b/tt.rkt
index a893c78..19397e2 100644 (file)
--- a/tt.rkt
+++ b/tt.rkt
                                      local-time?)])
             (+ ts-epoch tz-offset))]
          [_
-           (log-error "Invalid timestamp: ~v" ts)
+           (log-debug "Invalid timestamp: ~v" ts)
            #f]))))
 
 (: str->msg (-> (Option String) Url String (Option Msg)))
        (with-handlers*
          ([exn:fail?
             (λ (e)
-               (log-error
+               (log-debug
                  "Failed to parse msg: ~v, from: ~v, at: ~v, because: ~v"
                  str-head nick (url->string uri) e)
                #f)])
                             (regexp-match* #px"@<[^\\s]+([\\s]+)?[^>]+>" text))])
                     (Msg ts-epoch ts-orig nick uri text mentions))
                   (begin
-                    (log-error
+                    (log-debug
                       "Msg rejected due to invalid timestamp: ~v, nick:~v, uri:~v"
                       str-head nick (url->string uri))
                     #f)))]
   (if (file-exists? path-v2)
       (file->string path-v2)
       (begin
-        (log-warning "Cache file not found for URI: ~a" (url->string uri))
+        (log-debug "Cache file not found for URI: ~a" (url->string uri))
         #f)))
 
 (: str->url (-> String (Option String)))
          #f]
        [url (Peer nick url comment)])]
     [_
-      (log-error "Invalid peer string: ~v" str)
+      (log-debug "Invalid peer string: ~v" str)
       #f]))
 
 (module+ test
 (: peer->msgs (-> Peer (Listof Msg)))
 (define (peer->msgs peer)
   (match-define (Peer nick uri _) peer)
-  (log-info "Reading peer nick:~v uri:~v" nick (url->string uri))
+  (log-debug "Reading peer nick:~v uri:~v" nick (url->string uri))
   (define msgs-data (uri-read-cached uri))
   (if msgs-data
       (str->msgs nick uri msgs-data)
     (append* (map (λ (filename)
                      (define path (build-path cache-object-dir filename))
                      (define size (/ (file-size path) 1000000.0))
-                     (log-info "BEGIN parsing ~a MB from file: ~v"
+                     (log-debug "BEGIN parsing ~a MB from file: ~v"
                                size
                                (path->string path))
                      (define t0 (current-inexact-milliseconds))
                                  (filter-comments
                                    (file->lines path))))
                      (define t1 (current-inexact-milliseconds))
-                     (log-info "END parsing ~a MB in ~a seconds from file: ~v."
+                     (log-debug "END parsing ~a MB in ~a seconds from file: ~v."
                                size
                                (* 0.001 (- t1 t0))
                                (path->string path))
                      (when (empty? m)
-                       (log-warning "No messages found in ~a" (path->string path)))
+                       (log-debug "No messages found in ~a" (path->string path)))
                      m)
                   (directory-list cache-object-dir))))
   (uniq (append* (map Msg-mentions msgs))))
This page took 0.028328 seconds and 4 git commands to generate.