8
"github.com/nikwo/dogger/level"
9
"github.com/nikwo/dogger/utility"
12
type LogContext interface {
15
GetLevel() level.Level
17
SetCaller(caller string)
18
SetLevel(lvl level.Level)
19
Deadline() (deadline time.Time, ok bool)
20
Done() <-chan struct{}
22
Value(key interface{}) interface{}
25
func NewLogContext(ctx context.Context, lvl level.Level, callerRecurse ...int) LogContext {
28
if len(callerRecurse) > 0 {
29
layer += callerRecurse[0]
32
lc := &logContext{Context: ctx, Time: time.Now()}
33
pc, _, _, ok := runtime.Caller(2 + layer)
39
details := runtime.FuncForPC(pc)
40
file, line := details.FileLine(pc)
41
caller = utility.FormatCaller(file, details.Name(), line)
48
type logContext struct {
55
func (c *logContext) GetTime() time.Time {
59
func (c *logContext) GetCaller() string {
63
func (c *logContext) GetLevel() level.Level {
67
func (c *logContext) SetTime(t time.Time) {
71
func (c *logContext) SetCaller(caller string) {
75
func (c *logContext) SetLevel(lvl level.Level) {