mirror of
https://git.vectorsigma.ru/public/atlantis.git
synced 2026-07-29 01:58:18 +00:00
feat: suppress log package logging (#3076)
To suppress uber-go/tally logs which are not structured logs.
This commit is contained in:
@@ -1063,6 +1063,7 @@ func setupE2E(t *testing.T, repoDir string, opt setupOption) (events_controllers
|
||||
projectCmdOutputHandler := jobmocks.NewMockProjectCommandOutputHandler()
|
||||
|
||||
// Real dependencies.
|
||||
logging.SuppressDefaultLogging()
|
||||
logger := logging.NewNoopLogger(t)
|
||||
|
||||
eventParser := &events.EventParser{
|
||||
|
||||
12
server/logging/log.go
Normal file
12
server/logging/log.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package logging
|
||||
|
||||
import (
|
||||
"io"
|
||||
"log"
|
||||
)
|
||||
|
||||
// SuppressDefaultLogging suppresses the default logging
|
||||
func SuppressDefaultLogging() {
|
||||
// Some packages use the default logger, so we need to suppress it. (such as uber-go/tally)
|
||||
log.SetOutput(io.Discard)
|
||||
}
|
||||
@@ -153,6 +153,7 @@ type WebhookConfig struct {
|
||||
// its dependencies an error will be returned. This is like the main() function
|
||||
// for the server CLI command because it injects all the dependencies.
|
||||
func NewServer(userConfig UserConfig, config Config) (*Server, error) {
|
||||
logging.SuppressDefaultLogging()
|
||||
logger, err := logging.NewStructuredLoggerFromLevel(userConfig.ToLogLevel())
|
||||
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user