Skip to content

Commit

Permalink
FranzCross,workspace-window: add menu item to export breadcrumbs
Browse files Browse the repository at this point in the history
  • Loading branch information
Bogdanp committed Dec 1, 2023
1 parent acbbe24 commit 1d77ebb
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion FranzCross/workspace-window.rkt
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
#lang racket/gui/easy

(require franz/broker
(require franz/breadcrumb
(submod franz/breadcrumb rpc)
franz/broker
franz/connection-details
(submod franz/connection-details rpc)
franz/schema-registry
(submod franz/schema-registry rpc)
franz/schema-registry/schema
(submod franz/workspace rpc)
net/sendurl
racket/date
racket/format
racket/match
"alert.rkt"
Expand Down Expand Up @@ -297,6 +300,10 @@
"Check for Updates..."
m:render-check-for-updates-dialog)
(menu-item-separator)
(menu-item
"Export Debug Info..."
do-export-debug-info)
(menu-item-separator)
(menu-item
"About &Franz"
m:render-about-window)))
Expand Down Expand Up @@ -329,6 +336,29 @@
(define password (and keychain (get-password keychain (SchemaRegistry-password-id registry))))
(activate-schema-registry registry password id))

(define (do-export-debug-info)
(define maybe-filename
(gui:put-file
#f ;message
#f ;parent
#f ;directory
"debug.txt" ;filename
"txt" ;extension
null ;style
'(("Plain Text" "*.txt"))))
(when maybe-filename
(call-with-output-file maybe-filename
#:exists 'truncate/replace
(lambda (out)
(for/list ([crumb (in-list (get-breadcrumbs))])
(define timestamp-str
(date->string (seconds->date (Breadcrumb-timestamp crumb)) #t))
(fprintf out "~a (~a)~n" timestamp-str (Breadcrumb-level crumb))
(fprintf out " ~a~n" (Breadcrumb-message crumb))
(when (Breadcrumb-details crumb)
(fprintf out " details: ~a~n" (Breadcrumb-details crumb)))
(fprintf out "~n"))))))

(module+ main
(require "testing.rkt")
(call-with-testing-context
Expand Down

0 comments on commit 1d77ebb

Please sign in to comment.