func (sl *SessionLogger) LogEvent(fields EventFields) {
	sl.Lock()
	defer sl.Unlock()

	// add "bytes written" counter:
	fields[SessionByteOffset] = atomic.LoadInt64(&sl.writtenBytes)

	// add "milliseconds since" timestamp:
	now := sl.timeSource().In(time.UTC).Round(time.Millisecond)
	fields[SessionEventTimestamp] = int(now.Sub(sl.createdTime).Nanoseconds() / 1000000)
	fields[EventTime] = now

	line := eventToLine(fields)

	if sl.eventsFile != nil {
		_, err := fmt.Fprintln(sl.eventsFile, line)
		if err != nil {
			log.Error(err)
		}
	}
}
// LogEvent logs an event associated with this session
LogEvent logs an event associated with this session
// LogEvent logs an event associated with this session
func (sl *SessionLogger) LogEvent(fields EventFields) {
	sl.Lock()
	defer sl.Unlock()
	fields[SessionByteOffset] = atomic.LoadInt64(&sl.writtenBytes)
	now := sl.timeSource().In(time.UTC).Round(time.Millisecond)
	fields[SessionEventTimestamp] = int(now.Sub(sl.createdTime).Nanoseconds() / 1000000)
	fields[EventTime] = now
	line := eventToLine(fields)
	if sl.eventsFile != nil {
		_, err := fmt.Fprintln(sl.eventsFile, line)
		if err != nil {
			log.Error(err)
		}
	}
}
func ( sl * SessionLogger ) LogEvent ( fields EventFields ) { sl . Lock ( ) defer sl . Unlock ( ) fields [ SessionByteOffset ] = atomic . LoadInt64 ( & sl . writtenBytes ) now := sl . timeSource ( ) . In ( time . UTC ) . Round ( time . Millisecond ) fields [ SessionEventTimestamp ] = int ( now . Sub ( sl . createdTime ) . Nanoseconds ( ) / 1000000 ) fields [ EventTime ] = now line := eventToLine ( fields ) if sl . eventsFile != nil { _ , err := fmt . Fprintln ( sl . eventsFile , line ) if err != nil { log . Error ( err ) } } }
LogEvent logs an event associated with this session
LogEvent logs an event associated with this session
// add "bytes written" counter: // add "milliseconds since" timestamp: