Skip to content

Replace logrus with log/slog#634

Merged
sairon merged 1 commit into
home-assistant:masterfrom
scop:refactor/log-slog
Mar 31, 2026
Merged

Replace logrus with log/slog#634
sairon merged 1 commit into
home-assistant:masterfrom
scop:refactor/log-slog

Conversation

@scop
Copy link
Copy Markdown
Member

@scop scop commented Feb 3, 2026

Large but low complexity PR, replaces logrus with the stdlib log/slog package.

Benefits of this include

  • One 3rd party dependency fewer
  • Slightly smaller binary
  • go vet (included in golangci-lint) helps flag errors

The log format produced is different, matter of taste which looks nicer, but I think users are not exposed to it much at all anyway in normal circumstances.

Copy link
Copy Markdown
Member

@sairon sairon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Needless to say, the reduction of binary size is negligible (~30kB) but having one dependency less is nice anyway. There are some minor nuances, like missing trace level which is now silently ignored and logging falls back to WARN, but I don't see it as a big deal, as we haven't used it explicitly and likely no one will even notice.

Thank you!

Copy link
Copy Markdown
Member

@sairon sairon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Needless to say, the reduction of binary size is negligible (~30kB) but having one dependency less is nice anyway. There are some minor nuances, like missing trace level which is now silently ignored and logging falls back to WARN, but I don't see it as a big deal, as we haven't used it explicitly and likely no one will even notice.

Thank you!

@sairon sairon merged commit 90ea722 into home-assistant:master Mar 31, 2026
9 checks passed
@scop scop deleted the refactor/log-slog branch April 1, 2026 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants