Internal Helpers
Backend
Logging
We use zerolog as a logging library and we provide some wrappers for convenience. You can get a logger like this in any of the Go binaries like this:
import "moyaflow/stream/pkg/log"
func DoSomething() {
log := log.Get()
}
or to add custom attributes:
import "moyaflow/stream/pkg/log"
func DoSomething() {
log := log.Get().With().Str("component", "my-service").Logger()
}
Note
The following is currently only available within solaris
To get a logger enriched from the current context:
import "moyaflow/stream/apps/solaris/shared/logctx"
func DoSomething() {
log := logctx.FromContext(ctx)
}
or with a component name:
import "moyaflow/stream/apps/solaris/shared/logctx"
func DoSomething() {
log := logctx.FromContextNamed(ctx, "my-service")
}
Frontend
Logging
We use LogTape as a logger in our frontend apps. Id you
are only adding logs for debugging purposes and plan on removing them later,
you can keep using console.. However, if you want to add a permanent log
like for warnings, errors or generally useful debug information you should use
the @helios/generic/frontend/logger internal library.
import { createLogger } from "@helios/generic/frontend/logger";
@Injectable()
export class MyService {
private log = createLogger("my-service");
}