Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions internal/api/rust/rust.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ import (
"golang.org/x/exp/slices"
)

// LogTarget is the name of the `target` we use in logToFile: it is in effect a fake "crate" that we tell the
// rust-sdk is producing the logs.
const LogTarget = "complement_crypto";

func DeleteOldLogs(prefix string) {
// delete old log files
files, _ := os.ReadDir("./logs")
Expand All @@ -35,7 +39,7 @@ func SetupLogs(prefix string) {
// log new files
matrix_sdk_ffi.InitPlatform(matrix_sdk_ffi.TracingConfiguration{
LogLevel: matrix_sdk_ffi.LogLevelTrace,
ExtraTargets: nil,
ExtraTargets: []string {LogTarget},
WriteToStdoutOrSystem: false,
WriteToFiles: &matrix_sdk_ffi.TracingFileConfiguration{
Path: "./logs",
Expand Down Expand Up @@ -745,7 +749,7 @@ func (c *RustClient) Logf(t ct.TestLike, format string, args ...interface{}) {
}

func (c *RustClient) logToFile(t ct.TestLike, format string, args ...interface{}) {
matrix_sdk_ffi.LogEvent("rust.go", &zero, matrix_sdk_ffi.LogLevelInfo, t.Name(), fmt.Sprintf(format, args...))
matrix_sdk_ffi.LogEvent("rust.go", &zero, matrix_sdk_ffi.LogLevelInfo, LogTarget + "::" + t.Name(), fmt.Sprintf(format, args...))
}

func (c *RustClient) ensureListening(t ct.TestLike, roomID string) {
Expand Down
Loading