Commit 0e829bb1 authored by Carsten Orthbandt's avatar Carsten Orthbandt
Browse files

P

parent 00c0c162
......@@ -17,6 +17,7 @@ import (
"sort"
"strconv"
"strings"
"sync"
"git.pixeltamer.net/gopub/timestamp"
"github.com/davecgh/go-spew/spew"
......@@ -83,18 +84,19 @@ var (
// Flags
const (
ShortTime Flags = 1 << 0
LongTime Flags = 0xffffffff ^ ShortTime
HideLevel Flags = 1 << 1
ShowLevel Flags = 0xffffffff ^ HideLevel
HideModule Flags = 1 << 2
ShowModule Flags = 0xffffffff ^ HideModule
HideCaller Flags = 0xffffffff ^ ShowCaller
ShowCaller Flags = 1 << 3
LineSplit Flags = 0xffffffff ^ NoLineSplit
NoLineSplit Flags = 1 << 4
HideTime Flags = 0xffffffff ^ ShowTime
ShowTime Flags = 1 << 5
ShortTime Flags = 1 << 0
LongTime Flags = 0xffffffff ^ ShortTime
HideLevel Flags = 1 << 1
ShowLevel Flags = 0xffffffff ^ HideLevel
HideModule Flags = 1 << 2
ShowModule Flags = 0xffffffff ^ HideModule
HideCaller Flags = 0xffffffff ^ ShowCaller
ShowCaller Flags = 1 << 3
LineSplit Flags = 0xffffffff ^ NoLineSplit
NoLineSplit Flags = 1 << 4
HideTime Flags = 0xffffffff ^ ShowTime
ShowTime Flags = 1 << 5
RFC5424Format Flags = 1 << 6 // todo
)
func (ls Level) String() string {
......@@ -459,3 +461,19 @@ func (le *LogEntry) AddCallerAttribute() {
}
le.Attr["Caller"] = f.Function + "," + strconv.Itoa(f.Line)
}
var pGlobal F
var pGlobalInit sync.Once
func PPrep(args ...interface{}) {
pGlobalInit.Do(func() {
pGlobal = MakeF(StdSink(), args...)
})
}
func P(args ...interface{}) {
pGlobalInit.Do(func() {
pGlobal = MakeF(StdSink())
})
pGlobal(args...)
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment