Skip to content

Conversation

@mxpv
Copy link
Member

@mxpv mxpv commented Apr 24, 2023

This PR reduces the spread of logrus imports. It moves logrus setup code to the log package to simplify migration to a new logger in the future (containerd/log#2)

@mxpv mxpv merged commit 4a67fe0 into containerd:main Apr 24, 2023
@mxpv mxpv deleted the logrus branch April 24, 2023 20:05
)

// SetLevel sets log level globally.
func SetLevel(level string) error {
Copy link
Member

Choose a reason for hiding this comment

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

Is it better if the type of the parameter is Level? so that when using it, we can call log.SetLevel(log.InfoLevel)

Of course, we can also add a check for the level parameter, eg.

// SetLevel sets log level globally.
func SetLevel(level Level) error {
        lvl, err := logrus.ParseLevel(level.String())
        if err != nil {
                return err
        }

        logrus.SetLevel(lvl)
        return nil
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants