mirror of
https://github.com/hanzoai/tasks.git
synced 2026-11-03 03:56:04 +00:00
Full module path rebrand from Temporal to Hanzo Tasks: - go.mod module: github.com/hanzoai/tasks - All internal Go imports updated (1906 files) - cmd/server renamed to cmd/tasksd - Binary name: tasksd (was temporal-server) - Docker images: hanzoai/tasks (was temporalio/server) - README rewritten with Hanzo Tasks branding - LLM.md created with integration notes - Makefile, goreleaser, CI workflows updated - go.temporal.io/sdk and go.temporal.io/api imports preserved (separate repos) Fork of Temporal.io (MIT license).
52 lines
1.6 KiB
Go
52 lines
1.6 KiB
Go
//go:generate mockgen -package $GOPACKAGE -source $GOFILE -destination interface_mock.go
|
|
|
|
package log
|
|
|
|
import (
|
|
"github.com/hanzoai/tasks/common/log/tag"
|
|
)
|
|
|
|
type (
|
|
// Logger is the logging interface.
|
|
// Usage example:
|
|
// logger.Info("hello world",
|
|
// tag.WorkflowNextEventID(123),
|
|
// tag.WorkflowActionWorkflowStarted,
|
|
// tag.WorkflowNamespaceID("test-namespace-id")),
|
|
// )
|
|
// Note: msg should be static, do not use fmt.Sprintf() for msg. Anything dynamic should be tagged.
|
|
Logger interface {
|
|
Debug(msg string, tags ...tag.Tag)
|
|
Info(msg string, tags ...tag.Tag)
|
|
Warn(msg string, tags ...tag.Tag)
|
|
Error(msg string, tags ...tag.Tag)
|
|
DPanic(msg string, tags ...tag.Tag)
|
|
Panic(msg string, tags ...tag.Tag)
|
|
Fatal(msg string, tags ...tag.Tag)
|
|
}
|
|
|
|
// Implement WithLogger interface with With method which should return new instance of logger with prepended tags.
|
|
// If WithLogger is not implemented on logger, internal (not very efficient) preppender is used.
|
|
// Create prepended logger example:
|
|
// logger = log.With(
|
|
// logger,
|
|
// tag.WorkflowNextEventID(123),
|
|
// tag.WorkflowActionWorkflowStarted,
|
|
// tag.WorkflowNamespaceID("test-namespace-id"))
|
|
// ...
|
|
// logger.Info("hello world")
|
|
WithLogger interface {
|
|
With(tags ...tag.Tag) Logger
|
|
}
|
|
|
|
// If logger implements SkipLogger then Skip method will be called and extraSkip parameter will have
|
|
// number of extra stack trace frames to skip (useful to log caller func file/line).
|
|
SkipLogger interface {
|
|
Skip(extraSkip int) Logger
|
|
}
|
|
|
|
// Special logger types for use with fx
|
|
SnTaggedLogger Logger
|
|
ThrottledLogger Logger
|
|
)
|