Skip to content

Commit 2c0be05

Browse files
authored
Reduce the logging-related breaking changes (#3070)
* Reduce the logging-related breaking changes * Don't disable the stdout log when the `--log-file` option is used * Rename `--log-stdout` to `--log-format` and hide it * Deprecate the `--log-file` option
1 parent 5c48982 commit 2c0be05

File tree

5 files changed

+12
-10
lines changed

5 files changed

+12
-10
lines changed

beacon_chain/conf.nim

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,14 @@ type
9090
name: "log-level" }: string
9191

9292
logStdout* {.
93+
hidden
9394
desc: "Specifies what kind of logs should be written to stdout (auto, colors, nocolors, json)"
9495
defaultValueDesc: "auto"
9596
defaultValue: StdoutLogKind.Auto
96-
name: "log-stdout" }: StdoutLogKind
97+
name: "log-format" }: StdoutLogKind
9798

9899
logFile* {.
99-
desc: "Specifies a path for the written Json log file"
100+
desc: "Specifies a path for the written Json log file (deprecated)"
100101
name: "log-file" }: Option[OutFile]
101102

102103
eth2Network* {.
@@ -532,13 +533,14 @@ type
532533
name: "log-level" }: string
533534

534535
logStdout* {.
536+
hidden
535537
desc: "Specifies what kind of logs should be written to stdout (auto, colors, nocolors, json)"
536538
defaultValueDesc: "auto"
537539
defaultValue: StdoutLogKind.Auto
538-
name: "log-stdout" }: StdoutLogKind
540+
name: "log-format" }: StdoutLogKind
539541

540542
logFile* {.
541-
desc: "Specifies a path for the written Json log file"
543+
desc: "Specifies a path for the written Json log file (deprecated)"
542544
name: "log-file" }: Option[OutFile]
543545

544546
dataDir* {.

beacon_chain/nimbus_binary_common.nim

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,7 @@ proc setupLogging*(
136136

137137
let tmp =
138138
if stdoutKind == StdoutLogKind.Auto:
139-
if logFile.isSome():
140-
# No stdout logging by default, when file logging is enabled
141-
StdoutLogKind.None
142-
elif isatty(stdout):
139+
if isatty(stdout):
143140
# On a TTY, let's be fancy
144141
StdoutLogKind.Colors
145142
else:
@@ -167,6 +164,8 @@ proc setupLogging*(
167164
of StdoutLogKind.None:
168165
defaultChroniclesStream.outputs[0].writer = noOutput
169166

167+
if logFile.isSome():
168+
warn "The --log-file option is deprecated. Consider redirecting the standard output to a file instead"
170169
try:
171170
updateLogLevel(logLevel)
172171
except ValueError as err:

docs/the_nimbus_book/src/logging.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,4 @@ To send logs to a file, you can redirect the stdout logs:
5050
```
5151

5252
We recommend keeping an eye on the growth of this file with a [log rotator](./log-rotate.md). Logs are written in the "JSON Lines" format - one `json` entry per line.
53+

docs/the_nimbus_book/src/options.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ The following options are available:
2323
2424
--log-level Sets the log level for process and topics (e.g. "DEBUG;
2525
TRACE:discv5,libp2p; REQUIRED:none; DISABLED:none") [=INFO].
26-
--log-stdout Specifies what kind of logs should be written to stdout
26+
--log-format Specifies what kind of logs should be written to stdout (beta)
2727
(auto, colors, nocolors, json) [=auto].
2828
--log-file Specifies a path for the written Json log file.
2929
--network The Eth2 network to join [=mainnet].

scripts/launch_local_testnet.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ for NUM_NODE in $(seq 0 $(( NUM_NODES - 1 ))); do
443443
--nat:extip:127.0.0.1 \
444444
--network="${DATA_DIR}" \
445445
--log-level="${LOG_LEVEL}" \
446-
--log-stdout=json \
446+
--log-format=json \
447447
--tcp-port=$(( BASE_PORT + NUM_NODE )) \
448448
--udp-port=$(( BASE_PORT + NUM_NODE )) \
449449
--max-peers=$(( NUM_NODES - 1 )) \

0 commit comments

Comments
 (0)