Skip to content

[release/1.7 backport] Revert "log: define G() as a function instead of a variable"#9032

Merged
estesp merged 1 commit intocontainerd:release/1.7from
thaJeztah:1.7_backport_revert_log_var
Aug 31, 2023
Merged

[release/1.7 backport] Revert "log: define G() as a function instead of a variable"#9032
estesp merged 1 commit intocontainerd:release/1.7from
thaJeztah:1.7_backport_revert_log_var

Conversation

@thaJeztah
Copy link
Copy Markdown
Member

@thaJeztah thaJeztah commented Aug 30, 2023

This reverts commit 778ac30.

(slightly modified, due to changes that were merged after that).

The reverted commit had two elements;

  • Make G an actual function to improve the documentation
  • Prevent G from being overwritten externally

From the commit that's reverted:

The G variable is exported, and not expected to be overwritten
externally. Defining it as a function also documents it as a function
on https://pkg.go.dev, instead of a variable; https://pkg.go.dev/github.com/containerd/[email protected]/log#pkg-variables

While it's unclear if the ability to replace the implementation was intentional, it's this part that some external consumers were (ab)using.

We should look into that part in a follow-up, and design for this, for example by providing a utility to replace the logger, and properly document that.

In the meantime, let's revert the change.

(cherry picked from commit 19d6c37)

This reverts commit 778ac30.

(slightly modified, due to changes that were merged after that).

The reverted commit had two elements;

- Make `G` an actual function to improve the documentation
- Prevent `G` from being overwritten externally

From the commit that's reverted:

> The `G` variable is exported, and not expected to be overwritten
> externally. Defining it as a function also documents it as a function
> on https://pkg.go.dev, instead of a variable; https://pkg.go.dev/github.com/containerd/[email protected]/log#pkg-variables

While it's unclear if the ability to replace the implementation was
_intentional_, it's this part that some external consumers were (ab)using.

We should look into that part in a follow-up, and design for this, for
example by providing a utility to replace the logger, and properly document
that.

In the meantime, let's revert the change.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
(cherry picked from commit 19d6c37)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah thaJeztah force-pushed the 1.7_backport_revert_log_var branch from 8ebb308 to 4d1cfbb Compare August 30, 2023 19:47
neersighted added a commit to neersighted/moby that referenced this pull request Aug 30, 2023
FIXME: `replace` with containerd/containerd#9032
to work around a logging API regression in v1.7.5.

Signed-off-by: Bjorn Neergaard <[email protected]>
neersighted added a commit to neersighted/moby that referenced this pull request Aug 30, 2023
FIXME: `replace` with containerd/containerd#9032
to work around a logging API regression in v1.7.5.

Signed-off-by: Bjorn Neergaard <[email protected]>
@k8s-ci-robot
Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@dmcgowan dmcgowan marked this pull request as ready for review August 31, 2023 13:56
@estesp estesp merged commit c2978c2 into containerd:release/1.7 Aug 31, 2023
@thaJeztah thaJeztah deleted the 1.7_backport_revert_log_var branch August 31, 2023 14:50
neersighted added a commit to neersighted/moby that referenced this pull request Sep 6, 2023
FIXME: `replace` with containerd/containerd#9032
to work around a logging API regression in v1.7.5.

Signed-off-by: Bjorn Neergaard <[email protected]>
neersighted added a commit to neersighted/moby that referenced this pull request Sep 7, 2023
FIXME: `replace` with containerd/containerd#9032
to work around a logging API regression in v1.7.5.

Signed-off-by: Bjorn Neergaard <[email protected]>
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.

5 participants