From f1007771997bd0401516eda87a7e0ac92f269680 Mon Sep 17 00:00:00 2001 From: adamdottv <2363879+adamdottv@users.noreply.github.com> Date: Fri, 9 May 2025 13:37:13 -0500 Subject: wip: logging improvements --- internal/session/manager.go | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'internal/session') diff --git a/internal/session/manager.go b/internal/session/manager.go index 8df421bd8..cd80fa584 100644 --- a/internal/session/manager.go +++ b/internal/session/manager.go @@ -4,8 +4,8 @@ import ( "context" "sync" - "github.com/opencode-ai/opencode/internal/logging" "github.com/opencode-ai/opencode/internal/pubsub" + "log/slog" ) // Manager handles session management, tracking the currently active session. @@ -41,7 +41,7 @@ func InitManager(service Service) { // SetCurrentSession changes the active session to the one with the specified ID. func SetCurrentSession(sessionID string) { if globalManager == nil { - logging.Warn("Session manager not initialized") + slog.Warn("Session manager not initialized") return } @@ -49,18 +49,17 @@ func SetCurrentSession(sessionID string) { defer globalManager.mu.Unlock() globalManager.currentSessionID = sessionID - logging.Debug("Current session changed", "sessionID", sessionID) + slog.Debug("Current session changed", "sessionID", sessionID) } // CurrentSessionID returns the ID of the currently active session. func CurrentSessionID() string { if globalManager == nil { - logging.Warn("Session manager not initialized") return "" } - globalManager.mu.RLock() - defer globalManager.mu.RUnlock() + // globalManager.mu.RLock() + // defer globalManager.mu.RUnlock() return globalManager.currentSessionID } @@ -69,7 +68,6 @@ func CurrentSessionID() string { // If no session is set or the session cannot be found, it returns nil. func CurrentSession() *Session { if globalManager == nil { - logging.Warn("Session manager not initialized") return nil } @@ -80,9 +78,8 @@ func CurrentSession() *Session { session, err := globalManager.service.Get(context.Background(), sessionID) if err != nil { - logging.Warn("Failed to get current session", "err", err) return nil } return &session -} \ No newline at end of file +} -- cgit v1.2.3