hashicorp / hashicorp/consul

Abstract logging inmethod RunWithClientAndLogger in plan.go

Open
#5,788 2 comments 0 reactions 0 assignees View on GitHub
type/enhancement
Dominant language
Go
Stars
30.1k
Forks
4.6k
Avg merge
1d 18h
Merged PRs (30d)
39

Description

#### Feature Description

When using the method RunWithClientAndLogger in plan.go:56 we have to provide a pointer to consul api client and a pointer to std logger. The method itself uses just the Printf method of the logger.
Every application uses it's own logging package so we have to provide a "bridged" std logger in order to get a consistent logging experience.

Two possible solutions:

- We could just use a `Printf(format string, v ...interface{})` function in order to avoid instantiating the std logger and allow the user of the package to implement that function.
- Since go lacks of a logging abstraction based on interfaces consul could introduce one and let the user of the package implement it.

#### Use Case(s)

Any relevant use-cases that you see.

Contributor guide

Open the contributing guide

Research direction

Start with RunWithClientAndLogger in plan.go:56 and inspect how it uses the standard logger's Printf method. Review the two proposed approaches and determine the intended logging abstraction; done should provide callers a way to use their own logging package without a bridged standard logger.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.