Files
wehub-resource-sync 498b235461
Build and test / Build and test AMD64 Ubuntu 22.04 (push) Failing after 0s
Publish Builder / amazonlinux2023 (push) Failing after 1s
Build and test / UT for Go (push) Has been skipped
Publish KRTE Images / KRTE (push) Failing after 1s
Build and test / Integration Test (push) Has been skipped
Build and test / Upload Code Coverage (push) Has been skipped
Publish Builder / rockylinux9 (push) Failing after 1s
Publish Builder / ubuntu22.04 (push) Failing after 0s
Publish Builder / ubuntu24.04 (push) Failing after 0s
Publish Gpu Builder / publish-gpu-builder (push) Failing after 1s
Publish Test Images / PyTest (push) Failing after 0s
Build and test / UT for Cpp (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:31:17 +08:00

34 lines
1.1 KiB
Go

// Package mlog provides a context-aware logging library built on zap.
//
// It enforces context usage in all log operations and supports scoped field
// attachment via context. Context fields accumulate across WithFields calls,
// allowing child contexts to inherit parent fields.
//
// Basic usage:
//
// ctx := context.Background()
// mlog.Info(ctx, "request received", mlog.String("path", "/api/search"))
//
// Scoped context logging:
//
// ctx = mlog.WithFields(ctx, mlog.String("request_id", "abc123"))
// ctx = mlog.WithFields(ctx, mlog.Int64("user_id", 42))
// mlog.Info(ctx, "processing") // includes both request_id and user_id
//
// Cross-node field propagation via gRPC:
//
// // Attach fields that propagate across RPC calls
// ctx = mlog.WithFields(ctx,
// mlog.FieldCollectionName("my_collection", mlog.OptPropagated()),
// mlog.FieldCollectionID(12345, mlog.OptPropagated()),
// )
//
// // Use gRPC interceptors to automatically propagate fields
// // Server side: mlog.UnaryServerInterceptor("modulename")
// // Client side: mlog.UnaryClientInterceptor()
//
// Runtime log level changes:
//
// mlog.SetLevel(mlog.DebugLevel)
package mlog