Skip to content

Commit 271baf4

Browse files
authored
fix: session creation fixes and sessionEnd deprecated (#8)
2 parents 27c0285 + 5f9bb6d commit 271baf4

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

logging/logger.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,16 @@ func (l *Logger) AddTagToSession(sessionId, key, value string) {
7373
}
7474

7575
// SessionEnd marks the specified session as ended
76+
// Deprecated: please use EndSession instead, this will be removed in a future version
7677
func (l *Logger) SessionEnd(sessionId string) {
7778
end(l.writer, EntitySession, sessionId)
7879
}
7980

81+
// EndSession marks the specified session as ended
82+
func (l *Logger) EndSession(sessionId string) {
83+
end(l.writer, EntitySession, sessionId)
84+
}
85+
8086
// AddTraceToSession adds a trace to the specified session and returns the created trace
8187
// A Trace represents a single unit of work in your application, such as processing a specific user request
8288
// or performing a targeted task. Traces can be associated with Sessions and can contain their own

logging/session.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,17 @@ type Session struct {
1111
}
1212

1313
func newSession(c *SessionConfig, w *writer) *Session {
14-
return &Session{
14+
s := &Session{
1515
base: newBase(EntitySession, c.Id, &baseConfig{
1616
Id: c.Id,
1717
Name: c.Name,
1818
Tags: c.Tags,
1919
}, w),
2020
}
21+
sData := s.data()
22+
sData["id"] = c.Id
23+
s.commit("create", sData)
24+
return s
2125
}
2226

2327
func (s *Session) Feedback(f *Feedback) {

0 commit comments

Comments
 (0)