Skip to content

Filtered-out log.Level lines still cost #14

@bboreham

Description

@bboreham

I noticed a portion of our CPU was going into level.Debug(...).Log() lines, although that level wasn't enabled.

I think what is happening is the Log() call goes into context.Log() first, which calls bindValues which is the expensive part, calling runtime.Caller, formatting a timestamp, etc., then after that it goes to level.Log() which discards everything.

I looked around but didn't find any previous debate on this point. Am I holding it wrong? Is this expected?

Since we are using a wrapper, something like go-kit/kit#322 would let us work around the problem by checking before doing the work, but that was rejected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions