summaryrefslogtreecommitdiffhomepage
path: root/internal/session
diff options
context:
space:
mode:
authoradamdottv <[email protected]>2025-05-09 13:37:13 -0500
committeradamdottv <[email protected]>2025-05-09 13:37:13 -0500
commitf1007771997bd0401516eda87a7e0ac92f269680 (patch)
treed26198d031516eaebcc885870b470925492d8775 /internal/session
parentf41b7bbd0a0cc731fd7c471b7ee8b26f14a21755 (diff)
downloadopencode-f1007771997bd0401516eda87a7e0ac92f269680.tar.gz
opencode-f1007771997bd0401516eda87a7e0ac92f269680.zip
wip: logging improvements
Diffstat (limited to 'internal/session')
-rw-r--r--internal/session/manager.go15
1 files changed, 6 insertions, 9 deletions
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
+}