AddTraceEvent adds trace related to the entity with specified id, using the provided TraceEventDesc. If channelz is not turned ON, this will simply log the event descriptions.
(l grpclog.DepthLoggerV2, e Entity, depth int, desc *TraceEvent)
| 193 | // |
| 194 | // If channelz is not turned ON, this will simply log the event descriptions. |
| 195 | func AddTraceEvent(l grpclog.DepthLoggerV2, e Entity, depth int, desc *TraceEvent) { |
| 196 | // Log only the trace description associated with the bottom most entity. |
| 197 | d := fmt.Sprintf("[%s] %s", e, desc.Desc) |
| 198 | switch desc.Severity { |
| 199 | case CtUnknown, CtInfo: |
| 200 | l.InfoDepth(depth+1, d) |
| 201 | case CtWarning: |
| 202 | l.WarningDepth(depth+1, d) |
| 203 | case CtError: |
| 204 | l.ErrorDepth(depth+1, d) |
| 205 | } |
| 206 | |
| 207 | if getMaxTraceEntry() == 0 { |
| 208 | return |
| 209 | } |
| 210 | if IsOn() { |
| 211 | db.traceEvent(e.id(), desc) |
| 212 | } |
| 213 | } |