blob: 7ec4e37d5745ef7a50074d8601e8cb10e86e0120 [file] [log] [blame]
package mirko
import (
"context"
"fmt"
"github.com/golang/glog"
"golang.org/x/net/trace"
)
func TraceInfof(ctx context.Context, f string, args ...interface{}) {
tr, ok := trace.FromContext(ctx)
if !ok {
fmtd := fmt.Sprintf(f, args...)
glog.Infof("[no trace] %v", fmtd)
return
}
tr.LazyPrintf(f, args...)
}
func TraceWarningf(ctx context.Context, f string, args ...interface{}) {
glog.Warningf(f, args...)
tr, ok := trace.FromContext(ctx)
if ok {
tr.LazyPrintf(f, args...)
}
}
func TraceErrorf(ctx context.Context, f string, args ...interface{}) {
glog.Errorf(f, args...)
tr, ok := trace.FromContext(ctx)
if ok {
tr.LazyPrintf(f, args...)
}
}