Skip to content

Commit

Permalink
Swap all loggo.GetLogger calls to internal version
Browse files Browse the repository at this point in the history
Most if not all remaining calls to loggo package are now to setup
the writers. We can take care of that another time. It would be a
case of pushing that into the internal package and making the writers
have a basic standard.

For now, I've pushed this as much as I feel is required.
  • Loading branch information
SimonRichardson committed May 9, 2024
1 parent 3b4a68d commit 9ba72b2
Show file tree
Hide file tree
Showing 194 changed files with 544 additions and 508 deletions.
4 changes: 2 additions & 2 deletions agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (

"github.com/juju/collections/set"
"github.com/juju/errors"
"github.com/juju/loggo/v2"
"github.com/juju/names/v5"
"github.com/juju/utils/v4"
"github.com/juju/utils/v4/shell"
Expand All @@ -30,10 +29,11 @@ import (
"github.com/juju/juju/core/network"
"github.com/juju/juju/core/objectstore"
"github.com/juju/juju/core/paths"
internallogger "github.com/juju/juju/internal/logger"
"github.com/juju/juju/internal/mongo"
)

var logger = loggo.GetLogger("juju.agent")
var logger = internallogger.GetLogger("juju.agent")

const (
// BootstrapNonce is used as a nonce for the initial controller machine.
Expand Down
4 changes: 2 additions & 2 deletions agent/tools/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ package tools
import (
"io"

"github.com/juju/loggo/v2"
"github.com/juju/version/v2"

internallogger "github.com/juju/juju/internal/logger"
"github.com/juju/juju/internal/tools"
)

var logger = loggo.GetLogger("juju.agent.tools")
var logger = internallogger.GetLogger("juju.agent.tools")

// ToolsManager keeps track of a pool of tools
type ToolsManager interface {
Expand Down
4 changes: 2 additions & 2 deletions api/apiclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"github.com/juju/clock"
"github.com/juju/errors"
jujuhttp "github.com/juju/http/v2"
"github.com/juju/loggo/v2"
"github.com/juju/names/v5"
"github.com/juju/utils/v4"
"github.com/juju/utils/v4/parallel"
Expand All @@ -36,6 +35,7 @@ import (
"github.com/juju/juju/core/facades"
coremacaroon "github.com/juju/juju/core/macaroon"
"github.com/juju/juju/core/network"
internallogger "github.com/juju/juju/internal/logger"
jujuproxy "github.com/juju/juju/internal/proxy"
proxy "github.com/juju/juju/internal/proxy/config"
"github.com/juju/juju/rpc"
Expand All @@ -55,7 +55,7 @@ const pingTimeout = 30 * time.Second
// modelRoot is the prefix that all model API paths begin with.
const modelRoot = "/model/"

var logger = loggo.GetLogger("juju.api")
var logger = internallogger.GetLogger("juju.api")

type rpcConnection interface {
Call(ctx context.Context, req rpc.Request, params, response interface{}) error
Expand Down
4 changes: 2 additions & 2 deletions api/client/application/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/juju/charm/v13"
"github.com/juju/collections/set"
"github.com/juju/errors"
"github.com/juju/loggo/v2"
"github.com/juju/names/v5"

"github.com/juju/juju/api/base"
Expand All @@ -23,6 +22,7 @@ import (
"github.com/juju/juju/core/crossmodel"
"github.com/juju/juju/core/devices"
"github.com/juju/juju/core/instance"
internallogger "github.com/juju/juju/internal/logger"
"github.com/juju/juju/internal/storage"
"github.com/juju/juju/rpc/params"
)
Expand All @@ -34,7 +34,7 @@ type Option = base.Option
// supplied tracer.
var WithTracer = base.WithTracer

var logger = loggo.GetLogger("juju.api.application")
var logger = internallogger.GetLogger("juju.api.application")

// Client allows access to the application API end point.
type Client struct {
Expand Down
4 changes: 2 additions & 2 deletions api/client/applicationoffers/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import (
"github.com/go-macaroon-bakery/macaroon-bakery/v3/bakery"
"github.com/juju/charm/v13"
"github.com/juju/errors"
"github.com/juju/loggo/v2"
"github.com/juju/names/v5"

"github.com/juju/juju/api/base"
"github.com/juju/juju/core/crossmodel"
"github.com/juju/juju/core/permission"
"github.com/juju/juju/core/relation"
internallogger "github.com/juju/juju/internal/logger"
"github.com/juju/juju/rpc/params"
)

Expand All @@ -26,7 +26,7 @@ type Option = base.Option
// supplied tracer.
var WithTracer = base.WithTracer

var logger = loggo.GetLogger("juju.api.applicationoffers")
var logger = internallogger.GetLogger("juju.api.applicationoffers")

// Client allows access to the cross model management API end points.
type Client struct {
Expand Down
4 changes: 2 additions & 2 deletions api/client/cloud/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import (
"strings"

"github.com/juju/errors"
"github.com/juju/loggo/v2"
"github.com/juju/names/v5"

"github.com/juju/juju/api/base"
jujucloud "github.com/juju/juju/cloud"
"github.com/juju/juju/core/permission"
internallogger "github.com/juju/juju/internal/logger"
"github.com/juju/juju/rpc/params"
)

Expand All @@ -24,7 +24,7 @@ type Option = base.Option
// supplied tracer.
var WithTracer = base.WithTracer

var logger = loggo.GetLogger("juju.api.cloud")
var logger = internallogger.GetLogger("juju.api.cloud")

// CloudInfo holds cloud details and who can access the cloud.
type CloudInfo struct {
Expand Down
4 changes: 2 additions & 2 deletions api/client/modelmanager/modelmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"time"

"github.com/juju/errors"
"github.com/juju/loggo/v2"
"github.com/juju/names/v5"
"gopkg.in/yaml.v2"

Expand All @@ -19,6 +18,7 @@ import (
"github.com/juju/juju/core/model"
"github.com/juju/juju/core/permission"
"github.com/juju/juju/environs/config"
internallogger "github.com/juju/juju/internal/logger"
"github.com/juju/juju/rpc/params"
)

Expand All @@ -29,7 +29,7 @@ type Option = base.Option
// supplied tracer.
var WithTracer = base.WithTracer

var logger = loggo.GetLogger("juju.api.modelmanager")
var logger = internallogger.GetLogger("juju.api.modelmanager")

// Client provides methods that the Juju client command uses to interact
// with models stored in the Juju Server.
Expand Down
4 changes: 2 additions & 2 deletions api/client/usermanager/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
"strings"

"github.com/juju/errors"
"github.com/juju/loggo/v2"
"github.com/juju/names/v5"

"github.com/juju/juju/api/base"
internallogger "github.com/juju/juju/internal/logger"
"github.com/juju/juju/rpc/params"
)

Expand All @@ -23,7 +23,7 @@ type Option = base.Option
// supplied tracer.
var WithTracer = base.WithTracer

var logger = loggo.GetLogger("juju.api.usermanager")
var logger = internallogger.GetLogger("juju.api.usermanager")

// Client provides methods that the Juju client command uses to interact
// with users stored in the Juju Server.
Expand Down
4 changes: 2 additions & 2 deletions api/controller/applicationscaler/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"context"

"github.com/juju/errors"
"github.com/juju/loggo/v2"
"github.com/juju/names/v5"

"github.com/juju/juju/api/base"
"github.com/juju/juju/core/watcher"
internallogger "github.com/juju/juju/internal/logger"
"github.com/juju/juju/rpc/params"
)

Expand All @@ -22,7 +22,7 @@ type Option = base.Option
// supplied tracer.
var WithTracer = base.WithTracer

var logger = loggo.GetLogger("juju.api.applicationscaler")
var logger = internallogger.GetLogger("juju.api.applicationscaler")

// NewWatcherFunc exists to let us test Watch properly.
type NewWatcherFunc func(base.APICaller, params.StringsWatchResult) watcher.StringsWatcher
Expand Down
4 changes: 2 additions & 2 deletions api/controller/crossmodelrelations/crossmodelrelations.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import (
"github.com/go-macaroon-bakery/macaroon-bakery/v3/bakery"
"github.com/juju/clock"
"github.com/juju/errors"
"github.com/juju/loggo/v2"
"gopkg.in/macaroon.v2"

"github.com/juju/juju/api/base"
apiwatcher "github.com/juju/juju/api/watcher"
"github.com/juju/juju/core/watcher"
internallogger "github.com/juju/juju/internal/logger"
"github.com/juju/juju/rpc/params"
)

Expand All @@ -25,7 +25,7 @@ type Option = base.Option
// supplied tracer.
var WithTracer = base.WithTracer

var logger = loggo.GetLogger("juju.api.crossmodelrelations")
var logger = internallogger.GetLogger("juju.api.crossmodelrelations")

// Client provides access to the crossmodelrelations api facade.
type Client struct {
Expand Down
4 changes: 2 additions & 2 deletions api/controller/crossmodelsecrets/crossmodelsecrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import (
"github.com/go-macaroon-bakery/macaroon-bakery/v3/bakery"
"github.com/juju/clock"
"github.com/juju/errors"
"github.com/juju/loggo/v2"
"github.com/juju/retry"
"gopkg.in/macaroon.v2"

"github.com/juju/juju/api/base"
"github.com/juju/juju/api/controller/crossmodelrelations"
apiservererrors "github.com/juju/juju/apiserver/errors"
coresecrets "github.com/juju/juju/core/secrets"
internallogger "github.com/juju/juju/internal/logger"
"github.com/juju/juju/internal/secrets"
"github.com/juju/juju/internal/secrets/provider"
"github.com/juju/juju/rpc/params"
Expand Down Expand Up @@ -54,7 +54,7 @@ func NewClientWithCache(caller base.APICallCloser, cache *crossmodelrelations.Ma
}
}

var logger = loggo.GetLogger("juju.api.crossmodelsecrets")
var logger = internallogger.GetLogger("juju.api.crossmodelsecrets")

func (c *Client) handleDischargeError(ctx context.Context, apiErr error) (macaroon.Slice, error) {
errResp := errors.Cause(apiErr).(*params.Error)
Expand Down
9 changes: 5 additions & 4 deletions api/watcher/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,22 @@ import (
"time"

"github.com/juju/errors"
"github.com/juju/loggo/v2"
"github.com/juju/names/v5"
"github.com/kr/pretty"
"gopkg.in/tomb.v2"

"github.com/juju/juju/api/base"
corelogger "github.com/juju/juju/core/logger"
"github.com/juju/juju/core/migration"
"github.com/juju/juju/core/secrets"
"github.com/juju/juju/core/status"
"github.com/juju/juju/core/watcher"
internallogger "github.com/juju/juju/internal/logger"
"github.com/juju/juju/rpc"
"github.com/juju/juju/rpc/params"
)

var logger = loggo.GetLogger("juju.api.watcher")
var logger = internallogger.GetLogger("juju.api.watcher")

const (
// WatcherStopTimeout is the time to wait for a watcher to stop.
Expand Down Expand Up @@ -293,7 +294,7 @@ func (w *stringsWatcher) Changes() <-chan []string {
type relationUnitsWatcher struct {
commonWatcher
caller base.APICaller
logger loggo.Logger
logger corelogger.Logger
relationUnitsWatcherId string
out chan watcher.RelationUnitsChange
}
Expand Down Expand Up @@ -381,7 +382,7 @@ type RemoteRelationWatcher = watcher.Watcher[params.RemoteRelationChangeEvent]
type remoteRelationWatcher struct {
commonWatcher
caller base.APICaller
logger loggo.Logger
logger corelogger.Logger
remoteRelationWatcherId string
out chan params.RemoteRelationChangeEvent
}
Expand Down
4 changes: 2 additions & 2 deletions apiserver/authentication/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/go-macaroon-bakery/macaroon-bakery/v3/httpbakery"
"github.com/juju/clock"
"github.com/juju/errors"
"github.com/juju/loggo/v2"
"github.com/juju/names/v5"
"gopkg.in/macaroon.v2"

Expand All @@ -24,6 +23,7 @@ import (
coreuser "github.com/juju/juju/core/user"
usererrors "github.com/juju/juju/domain/access/errors"
"github.com/juju/juju/internal/auth"
internallogger "github.com/juju/juju/internal/logger"
"github.com/juju/juju/state"
)

Expand All @@ -33,7 +33,7 @@ const (
ErrInvalidLoginMacaroon = errors.ConstError("invalid login macaroon")
)

var logger = loggo.GetLogger("juju.apiserver.authentication")
var logger = internallogger.GetLogger("juju.apiserver.authentication")

// UserService is the interface that wraps the methods required to
// authenticate a user.
Expand Down
4 changes: 2 additions & 2 deletions apiserver/bakeryutil/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (

"github.com/go-macaroon-bakery/macaroon-bakery/v3/bakery"
"github.com/go-macaroon-bakery/macaroon-bakery/v3/bakery/checkers"
"github.com/juju/loggo/v2"
"gopkg.in/macaroon.v2"

"github.com/juju/juju/apiserver/authentication"
internallogger "github.com/juju/juju/internal/logger"
"github.com/juju/juju/state/bakerystorage"
)

Expand Down Expand Up @@ -59,7 +59,7 @@ func (s *ExpirableStorageBakery) NewMacaroon(ctx context.Context, version bakery
return s.Oven.NewMacaroon(ctx, version, caveats, ops...)
}

var logger = loggo.GetLogger("juju.apiserver.bakery")
var logger = internallogger.GetLogger("juju.apiserver.bakery")

// Auth implements MacaroonChecker.Auth.
func (s *ExpirableStorageBakery) Auth(ctx context.Context, mss ...macaroon.Slice) *bakery.AuthChecker {
Expand Down
4 changes: 2 additions & 2 deletions apiserver/common/firewall/firewall.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ package firewall
import (
"github.com/juju/charm/v13"
"github.com/juju/errors"
"github.com/juju/loggo/v2"
"github.com/juju/names/v5"

apiservererrors "github.com/juju/juju/apiserver/errors"
"github.com/juju/juju/apiserver/facade"
internallogger "github.com/juju/juju/internal/logger"
"github.com/juju/juju/rpc/params"
"github.com/juju/juju/state/watcher"
)

var logger = loggo.GetLogger("juju.apiserver.crossmodelrelations")
var logger = internallogger.GetLogger("juju.apiserver.crossmodelrelations")

// WatchEgressAddressesForRelations creates a watcher that notifies when addresses, from which
// connections will originate for the relation, change.
Expand Down
4 changes: 2 additions & 2 deletions apiserver/common/networkingcommon/networkconfigapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ import (

"github.com/juju/collections/set"
"github.com/juju/errors"
"github.com/juju/loggo/v2"
"github.com/juju/mgo/v3/txn"
"github.com/juju/names/v5"

"github.com/juju/juju/apiserver/common"
apiservererrors "github.com/juju/juju/apiserver/errors"
"github.com/juju/juju/core/network"
internallogger "github.com/juju/juju/internal/logger"
"github.com/juju/juju/rpc/params"
"github.com/juju/juju/state"
)

var logger = loggo.GetLogger("juju.apiserver.common.networkingcommon")
var logger = internallogger.GetLogger("juju.apiserver.common.networkingcommon")

// NetworkService is the interface that is used to interact with the
// network spaces/subnets.
Expand Down
4 changes: 2 additions & 2 deletions apiserver/common/password.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import (
"context"

"github.com/juju/errors"
"github.com/juju/loggo/v2"
"github.com/juju/names/v5"

apiservererrors "github.com/juju/juju/apiserver/errors"
internallogger "github.com/juju/juju/internal/logger"
"github.com/juju/juju/rpc/params"
"github.com/juju/juju/state"
)

var logger = loggo.GetLogger("juju.apiserver.common")
var logger = internallogger.GetLogger("juju.apiserver.common")

// PasswordChanger implements a common SetPasswords method for use by
// various facades.
Expand Down
Loading

0 comments on commit 9ba72b2

Please sign in to comment.