1// Copyright (c) Microsoft Corporation 2025
2// Z3 Go API: Logging functionality
21// OpenLog opens an interaction log file
22// Returns true if successful, false otherwise
23func OpenLog(filename string) bool {
25 defer logMutex.Unlock()
27 cFilename := C.CString(filename)
28 defer C.free(unsafe.Pointer(cFilename))
30 result := C.Z3_open_log(cFilename)
38// CloseLog closes the interaction log
41 defer logMutex.Unlock()
47// EnableTrace enables trace messages for tag.
48func EnableTrace(tag string) {
50 defer logMutex.Unlock()
52 cTag := C.CString(tag)
53 defer C.free(unsafe.Pointer(cTag))
54 C.Z3_enable_trace(cTag)
57// DisableTrace disables trace messages for tag.
58func DisableTrace(tag string) {
60 defer logMutex.Unlock()
62 cTag := C.CString(tag)
63 defer C.free(unsafe.Pointer(cTag))
64 C.Z3_disable_trace(cTag)
67// AppendLog appends a user-provided string to the interaction log
68// Panics if the log is not open
69func AppendLog(s string) {
71 defer logMutex.Unlock()
74 panic("Log is not open")
78 defer C.free(unsafe.Pointer(cStr))
82// IsLogOpen returns true if the interaction log is open
83func IsLogOpen() bool {
85 defer logMutex.Unlock()