parseContext returns a log context and REMOVES the context from the details map
(details map[string]string)
| 333 | |
| 334 | // parseContext returns a log context and REMOVES the context from the details map |
| 335 | func parseContext(details map[string]string) (logContext, error) { |
| 336 | nodeID, ok := details["com.docker.swarm.node.id"] |
| 337 | if !ok { |
| 338 | return logContext{}, fmt.Errorf("missing node id in details: %v", details) |
| 339 | } |
| 340 | delete(details, "com.docker.swarm.node.id") |
| 341 | |
| 342 | serviceID, ok := details["com.docker.swarm.service.id"] |
| 343 | if !ok { |
| 344 | return logContext{}, fmt.Errorf("missing service id in details: %v", details) |
| 345 | } |
| 346 | delete(details, "com.docker.swarm.service.id") |
| 347 | |
| 348 | taskID, ok := details["com.docker.swarm.task.id"] |
| 349 | if !ok { |
| 350 | return logContext{}, fmt.Errorf("missing task id in details: %s", details) |
| 351 | } |
| 352 | delete(details, "com.docker.swarm.task.id") |
| 353 | |
| 354 | return logContext{ |
| 355 | nodeID: nodeID, |
| 356 | serviceID: serviceID, |
| 357 | taskID: taskID, |
| 358 | }, nil |
| 359 | } |
| 360 | |
| 361 | type logContext struct { |
| 362 | nodeID string |
no outgoing calls
no test coverage detected
searching dependent graphs…