Various style fixes

This commit is contained in:
Jakob Borg
2014-12-08 16:36:15 +01:00
parent 12d69e25dd
commit 9d07aa006d
13 changed files with 78 additions and 82 deletions

View File

@@ -86,7 +86,7 @@ const BufferSize = 64
type Logger struct {
subs map[int]*Subscription
nextId int
nextID int
mutex sync.Mutex
}
@@ -120,15 +120,15 @@ func NewLogger() *Logger {
func (l *Logger) Log(t EventType, data interface{}) {
l.mutex.Lock()
if debug {
dl.Debugln("log", l.nextId, t.String(), data)
dl.Debugln("log", l.nextID, t.String(), data)
}
e := Event{
ID: l.nextId,
ID: l.nextID,
Time: time.Now(),
Type: t,
Data: data,
}
l.nextId++
l.nextID++
for _, s := range l.subs {
if s.mask&t != 0 {
select {
@@ -148,10 +148,10 @@ func (l *Logger) Subscribe(mask EventType) *Subscription {
}
s := &Subscription{
mask: mask,
id: l.nextId,
id: l.nextID,
events: make(chan Event, BufferSize),
}
l.nextId++
l.nextID++
l.subs[s.id] = s
l.mutex.Unlock()
return s