Skip to content

[feature] Migrate logrus to slog #258

Open
@acald-creator

Description

@acald-creator

UPDATE: slog is currently available in Go 1.21, and we should make the effort to migrate to use slog.

Current Behavior

meshkit uses logrus for custom logging, and we created a custom logger that only returns certain fields such as

  • warn
  • info
  • error
  • debug

But we're lacking on the other fields that logrus has and we're using a mixture of logrus and our custom logger.

meshkit will benefit from having more fields to call from, when utilizing the custom logging tool in meshery. This will help migrate mesheryctl to use the custom logger, instead of calling logrus directly.

For this purpose of tracking the migration, we will be migrating to use slog instead, which is slightly basic but gives us a bit more ability to customize logging and use more fields.

Here are the fields that slog currently supports

  • Info
  • InfoCtx
  • Warn
  • WarnCtx
  • Debug
  • DebugCtx
  • Error
  • ErrorCtx

There is no built-in support for formatting strings, but slog allows us to create our own fields.

Desired Behavior

Opening this issue to track the progress.


Resources

Alternatives / Additional Context

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions