Files
prysm/io/logs/BUILD.bazel
Bastin 6fa0e9cf5f Logrus hooks for terminal vs log-file output (#16102)
## Review after #16059 

**What type of PR is this?**
Feature

**What does this PR do?**
This PR introduces logrus writer hooks into the logging of prysm.
when log-format is text:
- set the default logrus output to be `io.Discard`
- create a writer hook for terminal, with formatting and coloring
enabled.
- create a separate writer hook for log-file (if enabled), without
coloring.

This immediately allows for having formatted/colored terminal logs,
while keeping the log-file clean.
2026-01-05 15:20:12 +00:00

33 lines
931 B
Python

load("@prysm//tools/go:def.bzl", "go_library", "go_test")
go_library(
name = "go_default_library",
srcs = [
"hook.go",
"logutil.go",
"stream.go",
],
importpath = "github.com/OffchainLabs/prysm/v7/io/logs",
visibility = ["//visibility:public"],
deps = [
"//async/event:go_default_library",
"//cache/lru:go_default_library",
"//config/params:go_default_library",
"//crypto/rand:go_default_library",
"//io/file:go_default_library",
"//runtime/logging/logrus-prefixed-formatter:go_default_library",
"@com_github_hashicorp_golang_lru//:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
],
)
go_test(
name = "go_default_test",
srcs = [
"logutil_test.go",
"stream_test.go",
],
embed = [":go_default_library"],
deps = ["//testing/require:go_default_library"],
)