2017-10-25 00:36:16 +02:00
|
|
|
package syslog
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
2019-06-20 09:25:43 +02:00
|
|
|
"github.com/bdlm/log"
|
2017-10-25 00:36:16 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestToEntry(t *testing.T) {
|
|
|
|
assert := assert.New(t)
|
|
|
|
entry := toLogEntry([]byte("<11>Aug 17 11:43:33 Msg"), "::1")
|
|
|
|
assert.Equal("Msg", entry.Message)
|
|
|
|
assert.Equal(log.ErrorLevel, entry.Level)
|
|
|
|
|
|
|
|
hostname, ok := entry.Data["hostname"]
|
|
|
|
assert.True(ok)
|
|
|
|
assert.Equal("::1", hostname)
|
|
|
|
|
|
|
|
}
|