Update dependencies to add service fabric mesh via new azure-sdk-go
This commit is contained in:
35
vendor/github.com/vmware/vic/pkg/trace/operation.go
generated
vendored
35
vendor/github.com/vmware/vic/pkg/trace/operation.go
generated
vendored
@@ -129,6 +129,10 @@ func (o *Operation) ID() string {
|
||||
return o.id
|
||||
}
|
||||
|
||||
func (o *Operation) Auditf(format string, args ...interface{}) {
|
||||
o.Infof(format, args...)
|
||||
}
|
||||
|
||||
func (o *Operation) Infof(format string, args ...interface{}) {
|
||||
o.Info(fmt.Sprintf(format, args...))
|
||||
}
|
||||
@@ -213,13 +217,22 @@ func (o *Operation) Fatal(args ...interface{}) {
|
||||
}
|
||||
}
|
||||
|
||||
func (o *Operation) newChild(ctx context.Context, msg string) Operation {
|
||||
child := newOperation(ctx, o.id, 4, msg)
|
||||
func (o Operation) newChildCommon(ctx context.Context, opID string, msg string) Operation {
|
||||
child := newOperation(ctx, opID, 5, msg)
|
||||
child.t = append(child.t, o.t...)
|
||||
child.Logger = o.Logger
|
||||
return child
|
||||
}
|
||||
|
||||
func (o Operation) newChild(ctx context.Context, msg string) Operation {
|
||||
return o.newChildCommon(ctx, o.id, msg)
|
||||
}
|
||||
|
||||
func (o Operation) newChildWithChainedID(ctx context.Context, msg string) Operation {
|
||||
childOpID := fmt.Sprintf("%s.%d", o.id, atomic.AddUint64(&opCount, 1))
|
||||
return o.newChildCommon(ctx, childOpID, msg)
|
||||
}
|
||||
|
||||
func opID(opNum uint64) string {
|
||||
return fmt.Sprintf("%d.%d", opIDPrefix, opNum)
|
||||
}
|
||||
@@ -233,6 +246,24 @@ func NewOperation(ctx context.Context, format string, args ...interface{}) Opera
|
||||
return o
|
||||
}
|
||||
|
||||
// NewOperationFromID returns a an Operation with the incoming ID if valid
|
||||
// It creates a parent operation with the incoming ID and a child with
|
||||
// the parent operation ID as a prefix and a monotonically incremented
|
||||
// integer as the suffix
|
||||
func NewOperationFromID(ctx context.Context, ID *string, format string, args ...interface{}) Operation {
|
||||
var o Operation
|
||||
if ID == nil || *ID == "" {
|
||||
o = newOperation(ctx, opID(atomic.AddUint64(&opCount, 1)), 3, fmt.Sprintf(format, args...))
|
||||
} else {
|
||||
msg := fmt.Sprintf(format, args...)
|
||||
o = newOperation(ctx, *ID, 3, msg).newChildWithChainedID(ctx, msg)
|
||||
}
|
||||
|
||||
frame := o.t[0]
|
||||
o.Debugf("[NewOperationFromID] %s [%s:%d]", o.header(), frame.funcName, frame.lineNo)
|
||||
return o
|
||||
}
|
||||
|
||||
// NewOperationWithLoggerFrom will return a new operation with operationID added as a value to the
|
||||
// context and logging settings copied from the supplied operation.
|
||||
//
|
||||
|
||||
17
vendor/github.com/vmware/vic/pkg/trace/trace.go
generated
vendored
17
vendor/github.com/vmware/vic/pkg/trace/trace.go
generated
vendored
@@ -108,7 +108,7 @@ func newTrace(msg string, skip int, opID string) *Message {
|
||||
// Begin starts the trace. Msg is the msg to log.
|
||||
// context provided to allow tracing of operationID
|
||||
// context added as optional to avoid breaking current usage
|
||||
func Begin(msg string, ctx ...context.Context) *Message {
|
||||
func begin(msg string, ctx ...context.Context) *Message {
|
||||
if tracingEnabled && Logger.Level >= logrus.DebugLevel {
|
||||
var opID string
|
||||
// populate operationID if provided
|
||||
@@ -117,7 +117,7 @@ func Begin(msg string, ctx ...context.Context) *Message {
|
||||
opID = id
|
||||
}
|
||||
}
|
||||
if t := newTrace(msg, 2, opID); t != nil {
|
||||
if t := newTrace(msg, 3, opID); t != nil {
|
||||
if msg == "" {
|
||||
Logger.Debugf("[BEGIN] %s [%s:%d]", t.operationID, t.funcName, t.lineNo)
|
||||
} else {
|
||||
@@ -130,6 +130,19 @@ func Begin(msg string, ctx ...context.Context) *Message {
|
||||
return nil
|
||||
}
|
||||
|
||||
func Begin(msg string, ctx ...context.Context) *Message {
|
||||
return begin(msg, ctx...)
|
||||
}
|
||||
|
||||
// Audit is a wrapper around Begin which logs an Audit message after
|
||||
func Audit(msg string, op Operation) *Message {
|
||||
m := begin(msg, op)
|
||||
if len(op.t) > 0 { // We expect an operation to always have at least one frame, but check for safety
|
||||
op.Auditf(op.t[0].msg)
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
// End ends the trace.
|
||||
func End(t *Message) {
|
||||
if t == nil {
|
||||
|
||||
Reference in New Issue
Block a user