Documentation
¶
Overview ¶
Copyright 2025 HAProxy Technologies LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2025 HAProxy Technologies LLC ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2025 HAProxy Technologies LLC ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- Variables
- func GetLogSettings() (slog.Level, map[v3.Category]slog.Level)
- func LogAttrBackendName(name string) slog.Attr
- func LogAttrBatch(id, length int) slog.Attr
- func LogAttrCategory(category v3.Category) slog.Attr
- func LogAttrCommand(command string) slog.Attr
- func LogAttrDuration(duration time.Duration) slog.Attr
- func LogAttrError(err error) slog.Attr
- func LogAttrEventType(t string) slog.Attr
- func LogAttrFileSource(file string, line int) slog.Attr
- func LogAttrFrontendName(name string) slog.Attr
- func LogAttrGVK(gvk schema.GroupVersionKind) slog.Attr
- func LogAttrInstalledVersions(versions map[string]int) slog.Attr
- func LogAttrKey(key client.ObjectKey) slog.Attr
- func LogAttrKeyGVK(key client.ObjectKey, gvk schema.GroupVersionKind) slog.Attr
- func LogAttrLogLevel(level slog.Level) slog.Attr
- func LogAttrLogSettings(level slog.Level, settings map[v3.Category]slog.Level) slog.Attr
- func LogAttrMapFileContent(path string) slog.Attr
- func LogAttrMapFilePath(path string) slog.Attr
- func LogAttrNsName(nsName types.NamespacedName) slog.Attr
- func LogAttrObjectKey(obj client.Object) slog.Attr
- func LogAttrReloadMgrAction(state bool, reason string, args ...any) slog.Attr
- func LogAttrResource(obj client.Object, gvk schema.GroupVersionKind) slog.Attr
- func LogAttrRouteGroupKinds(routesGK []gatewayv1.RouteGroupKind) slog.Attr
- func LogAttrServerName(name string) slog.Attr
- func LogAttrVirtualListenerName(name string) slog.Attr
- func LogLevelString2SlogLevel(level string) slog.Level
- type CategoryFilterHandler
- func (*CategoryFilterHandler) Enabled(_ context.Context, _ slog.Level) bool
- func (h *CategoryFilterHandler) Handle(ctx context.Context, r slog.Record) error
- func (*CategoryFilterHandler) ReconcileLogSettings(aLevel slog.Level, categories map[v3.Category]slog.Level) bool
- func (h *CategoryFilterHandler) ResetToDefaults()
- func (h *CategoryFilterHandler) WithAttrs(attrs []slog.Attr) slog.Handler
- func (h *CategoryFilterHandler) WithGroup(name string) slog.Handler
- type CategoryFilterHandlerParams
- type ContextKey
- type LogHandlerType
Constants ¶
const (
LogCategoryKey = "category"
)
Variables ¶
var ( DefaultLogLevelPerCategory = map[v3.Category]slog.Level{ LogCategoryK8s: slog.LevelWarn, LogCategoryGate: slog.LevelInfo, LogCategoryApp: slog.LevelInfo, LogCategoryHaproxyCfgMgr: slog.LevelInfo, LogCategoryBatch: slog.LevelInfo, LogCategoryStatus: slog.LevelInfo, LogCategoryHugService: slog.LevelInfo, LogCategoryCertsStorage: slog.LevelInfo, LogCategoryMapsStorage: slog.LevelInfo, } DefaultLevel = slog.LevelInfo )
var ( LogCategoryK8s v3.Category = "k8s" LogCategoryGate v3.Category = "gate" LogCategoryStatus v3.Category = "status" LogCategoryHaproxyCfgMgr v3.Category = "haproxycfg" LogCategoryApp v3.Category = "app" LogCategoryBatch v3.Category = "batch" LogCategoryReloadMgr v3.Category = "reloadmgr" LogCategoryCertsStorage v3.Category = "certs-storage" LogCategoryMapsStorage v3.Category = "maps-storage" LogCategoryHugService v3.Category = "hugservice" )
Functions ¶
func LogAttrBackendName ¶
func LogAttrBatch ¶
func LogAttrCommand ¶ added in v0.9.0
func LogAttrError ¶
func LogAttrEventType ¶
func LogAttrFrontendName ¶
func LogAttrGVK ¶
func LogAttrGVK(gvk schema.GroupVersionKind) slog.Attr
func LogAttrKeyGVK ¶
func LogAttrLogSettings ¶
func LogAttrMapFileContent ¶ added in v0.9.1
func LogAttrMapFilePath ¶ added in v0.9.1
func LogAttrNsName ¶
func LogAttrNsName(nsName types.NamespacedName) slog.Attr
func LogAttrReloadMgrAction ¶
func LogAttrResource ¶
func LogAttrRouteGroupKinds ¶
func LogAttrRouteGroupKinds(routesGK []gatewayv1.RouteGroupKind) slog.Attr
func LogAttrServerName ¶
func LogAttrVirtualListenerName ¶ added in v0.9.0
Types ¶
type CategoryFilterHandler ¶
type CategoryFilterHandler struct {
// contains filtered or unexported fields
}
CategoryFilterHandler filters log records by level and key-value category.
func NewCategoryFilterHandler ¶
func NewCategoryFilterHandler(params CategoryFilterHandlerParams) *CategoryFilterHandler
NewCategoryFilterHandler wraps an existing handler and filters by level and category.
func (*CategoryFilterHandler) ReconcileLogSettings ¶
func (*CategoryFilterHandler) ResetToDefaults ¶
func (h *CategoryFilterHandler) ResetToDefaults()
type ContextKey ¶
type ContextKey string
const ( LevelNone slog.Level = 100 CallerAdditionalSkipKey ContextKey = "callerSkip" )
type LogHandlerType ¶
type LogHandlerType string
const ( LogHandlerTypeJSON LogHandlerType = "json" LogHandlerTypeText LogHandlerType = "text" )