Skip to content

Commit

Permalink
fix: IPFS_LOG_LEVEL is actually deprecated, help text updated
Browse files Browse the repository at this point in the history
  • Loading branch information
SgtPooki committed Feb 4, 2025
1 parent 4bd79bd commit 5680c49
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ RUN mkdir /container-init.d \
VOLUME $IPFS_PATH

# The default logging level
ENV IPFS_LOGGING ""
ENV GOLOG_LOG_LEVEL ""

# This just makes sure that:
# 1. There's an fs-repo, and initializes one if there isn't.
Expand Down
5 changes: 4 additions & 1 deletion cmd/ipfs/kubo/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,10 @@ func insideGUI() bool {
func checkDebug(req *cmds.Request) {
// check if user wants to debug. option OR env var.
debug, _ := req.Options["debug"].(bool)
if debug || os.Getenv("IPFS_LOGGING") == "debug" {
ipfsLogLevel, _ := logging.LevelFromString(os.Getenv("IPFS_LOGGING")) // IPFS_LOGGING is deprecated
goLogLevel, _ := logging.LevelFromString(os.Getenv("GOLOG_LOG_LEVEL"))

if debug || goLogLevel == logging.LevelDebug || ipfsLogLevel == logging.LevelDebug {
u.Debug = true
logging.SetDebugLogging()
}
Expand Down
8 changes: 4 additions & 4 deletions core/commands/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ var LogCmd = &cmds.Command{
'ipfs log' contains utility commands to affect or read the logging
output of a running daemon.
There are also two environmental variables that direct the logging
There are also two environmental variables that direct the logging
system (not just for the daemon logs, but all commands):
IPFS_LOGGING - sets the level of verbosity of the logging.
GOLOG_LOG_LEVEL - sets the level of verbosity of the logging.
One of: debug, info, warn, error, dpanic, panic, fatal
IPFS_LOGGING_FMT - sets formatting of the log output.
One of: color, nocolor
GOLOG_LOG_FMT - sets formatting of the log output.
One of: color, nocolor, json
`,
},

Expand Down
4 changes: 2 additions & 2 deletions plugin/plugins/peerlog/peerlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type plEvent struct {
//
// Usage:
//
// GOLOG_FILE=~/peer.log IPFS_LOGGING_FMT=json ipfs daemon
// GOLOG_FILE=~/peer.log GOLOG_LOG_FMT=json ipfs daemon
//
// Output:
//
Expand Down Expand Up @@ -186,7 +186,7 @@ func (pl *peerLogPlugin) Start(node *core.IpfsNode) error {
return nil
}

// Ensure logs from this plugin get printed regardless of global IPFS_LOGGING value
// Ensure logs from this plugin get printed regardless of global GOLOG_LOG_LEVEL value
if err := logging.SetLogLevel("plugin/peerlog", "info"); err != nil {
return fmt.Errorf("failed to set log level: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion test/3nodetest/bootstrap/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ RUN mv -f /tmp/id/config /root/.ipfs/config
RUN ipfs id

ENV IPFS_PROF true
ENV IPFS_LOGGING_FMT nocolor
ENV GOLOG_LOG_FMT nocolor

EXPOSE 4011 4012/udp
2 changes: 1 addition & 1 deletion test/3nodetest/client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN ipfs id
EXPOSE 4031 4032/udp

ENV IPFS_PROF true
ENV IPFS_LOGGING_FMT nocolor
ENV GOLOG_LOG_FMT nocolor

ENTRYPOINT ["/bin/bash"]
CMD ["/tmp/id/run.sh"]
6 changes: 3 additions & 3 deletions test/3nodetest/fig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ bootstrap:
- "4011"
- "4012/udp"
environment:
IPFS_LOGGING: debug
GOLOG_LOG_LEVEL: debug

server:
build: ./server
Expand All @@ -23,7 +23,7 @@ server:
- "4021"
- "4022/udp"
environment:
IPFS_LOGGING: debug
GOLOG_LOG_LEVEL: debug

client:
build: ./client
Expand All @@ -35,4 +35,4 @@ client:
- "4031"
- "4032/udp"
environment:
IPFS_LOGGING: debug
GOLOG_LOG_LEVEL: debug
2 changes: 1 addition & 1 deletion test/3nodetest/server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN chmod +x /tmp/test/run.sh
EXPOSE 4021 4022/udp

ENV IPFS_PROF true
ENV IPFS_LOGGING_FMT nocolor
ENV GOLOG_LOG_FMT nocolor

ENTRYPOINT ["/bin/bash"]
CMD ["/tmp/test/run.sh"]
2 changes: 1 addition & 1 deletion test/sharness/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The usual ipfs env flags also apply:

```sh
# the output will make your eyes bleed
IPFS_LOGGING=debug TEST_VERBOSE=1 make
GOLOG_LOG_LEVEL=debug TEST_VERBOSE=1 make
```

To make the tests abort as soon as an error occurs, use the TEST_IMMEDIATE env variable:
Expand Down

0 comments on commit 5680c49

Please sign in to comment.