You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Timers are automatically fired by advancing a mock workflow clock that is used for testing workflows
455
456
- You can register callbacks to fire at specific times (in mock-clock time). Callbacks can send signals, cancel workflows etc.
456
457
458
+
### Logging
459
+
460
+
For logging, you can pass a type to the backend via the `WithLogger` option to set a custom logger. Thetype has to implement this simple interface:
461
+
462
+
```go
463
+
type Logger interface {
464
+
Debug(msg string, fields ...interface{})
465
+
Warn(msg string, fields ...interface{})
466
+
Error(msg string, fields ...interface{})
467
+
Panic(msg string, fields ...interface{})
468
+
469
+
With(fields ...interface{}) Logger
470
+
}
471
+
```
472
+
473
+
If you don't pass a logger, a very simple, unoptimized default logger is used. For production use it is strongly recommended to pass another logger.
474
+
475
+
#### Workflows
476
+
477
+
For logging in workflows, you can get a logger using
478
+
479
+
```go
480
+
logger := workflow.Logger(ctx)
481
+
```
482
+
483
+
The returned `logger` implements the `Logger` interface, and already has the workflow instance and execution IDs set as default fields.
484
+
485
+
#### Activities
486
+
487
+
For logging in activities, you can get a logger using
488
+
489
+
```go
490
+
logger := activity.Logger(ctx)
491
+
```
492
+
493
+
The returned `logger` implements the `Logger` interface, and already has the id of the activity, and the workflow instance and execution IDs set as default fields.
494
+
457
495
## Versioning
458
496
459
497
For now, I've intentionally left our versioning. Cadence, Temporal, and DTFx all support the concept of versions for workflows as well as activities. This is mostly required when you make changes to workflows and need to keep backwards compatibility with workflows that are being executed at the time of the upgrade.
0 commit comments