diff --git a/BUILD.bazel b/BUILD.bazel index 4b01d2814..7d8bb39c4 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -46,7 +46,6 @@ filegroup( "//pkg/client/listers/certmanager/v1alpha1:all-srcs", "//pkg/controller:all-srcs", "//pkg/issuer:all-srcs", - "//pkg/logs:all-srcs", "//pkg/scheduler:all-srcs", "//pkg/util:all-srcs", "//test/e2e:all-srcs", diff --git a/cmd/controller/BUILD.bazel b/cmd/controller/BUILD.bazel index 9e9190acb..296c10ceb 100644 --- a/cmd/controller/BUILD.bazel +++ b/cmd/controller/BUILD.bazel @@ -33,7 +33,6 @@ go_library( "//pkg/issuer/ca:go_default_library", "//pkg/issuer/selfsigned:go_default_library", "//pkg/issuer/vault:go_default_library", - "//pkg/logs:go_default_library", "//pkg/util:go_default_library", "//vendor/github.com/golang/glog:go_default_library", "//vendor/github.com/gorilla/mux:go_default_library", diff --git a/cmd/controller/main.go b/cmd/controller/main.go index 06e4f255a..f4107369f 100644 --- a/cmd/controller/main.go +++ b/cmd/controller/main.go @@ -23,13 +23,9 @@ import ( "syscall" "github.com/golang/glog" - - "github.com/jetstack/cert-manager/pkg/logs" ) func main() { - logs.InitLogs() - defer logs.FlushLogs() stopCh := SetupSignalHandler() cmd := NewCommandStartCertManagerController(os.Stdout, os.Stderr, stopCh) diff --git a/pkg/logs/BUILD.bazel b/pkg/logs/BUILD.bazel deleted file mode 100644 index a974bd549..000000000 --- a/pkg/logs/BUILD.bazel +++ /dev/null @@ -1,27 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library") - -go_library( - name = "go_default_library", - srcs = ["logs.go"], - importpath = "github.com/jetstack/cert-manager/pkg/logs", - visibility = ["//visibility:public"], - deps = [ - "//vendor/github.com/golang/glog:go_default_library", - "//vendor/github.com/spf13/pflag:go_default_library", - "//vendor/k8s.io/apimachinery/pkg/util/wait:go_default_library", - ], -) - -filegroup( - name = "package-srcs", - srcs = glob(["**"]), - tags = ["automanaged"], - visibility = ["//visibility:private"], -) - -filegroup( - name = "all-srcs", - srcs = [":package-srcs"], - tags = ["automanaged"], - visibility = ["//visibility:public"], -) diff --git a/pkg/logs/logs.go b/pkg/logs/logs.go deleted file mode 100644 index fc5edf77c..000000000 --- a/pkg/logs/logs.go +++ /dev/null @@ -1,61 +0,0 @@ -/* -Copyright 2018 The Jetstack cert-manager contributors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package logs - -import ( - "flag" - "log" - "time" - - "github.com/golang/glog" - "github.com/spf13/pflag" - "k8s.io/apimachinery/pkg/util/wait" -) - -var logFlushFreq = pflag.Duration("log-flush-frequency", 5*time.Second, "Maximum number of seconds between log flushes") - -// TODO(thockin): This is temporary until we agree on log dirs and put those into each cmd. -func init() { - flag.Set("logtostderr", "true") -} - -// GlogWriter serves as a bridge between the standard log package and the glog package. -type GlogWriter struct{} - -// Write implements the io.Writer interface. -func (writer GlogWriter) Write(data []byte) (n int, err error) { - glog.Info(string(data)) - return len(data), nil -} - -// InitLogs initializes logs the way we want for kubernetes. -func InitLogs() { - log.SetOutput(GlogWriter{}) - log.SetFlags(0) - // The default glog flush interval is 30 seconds, which is frighteningly long. - go wait.Until(glog.Flush, *logFlushFreq, wait.NeverStop) -} - -// FlushLogs flushes logs immediately. -func FlushLogs() { - glog.Flush() -} - -// NewLogger creates a new log.Logger which sends logs to glog.Info. -func NewLogger(prefix string) *log.Logger { - return log.New(GlogWriter{}, prefix, 0) -} diff --git a/test/e2e/BUILD.bazel b/test/e2e/BUILD.bazel index 7c34f01d0..5ea59540c 100644 --- a/test/e2e/BUILD.bazel +++ b/test/e2e/BUILD.bazel @@ -18,7 +18,6 @@ go_library( tags = ["manual"], visibility = ["//visibility:public"], deps = [ - "//pkg/logs:go_default_library", "//test/e2e/certificate:go_default_library", "//test/e2e/clusterissuer:go_default_library", "//test/e2e/framework:go_default_library", diff --git a/test/e2e/e2e.go b/test/e2e/e2e.go index 7f3377817..a420d7552 100644 --- a/test/e2e/e2e.go +++ b/test/e2e/e2e.go @@ -30,7 +30,6 @@ import ( "github.com/onsi/gomega" _ "k8s.io/client-go/plugin/pkg/client/auth" - "github.com/jetstack/cert-manager/pkg/logs" _ "github.com/jetstack/cert-manager/test/e2e/certificate" _ "github.com/jetstack/cert-manager/test/e2e/clusterissuer" "github.com/jetstack/cert-manager/test/e2e/framework" @@ -43,9 +42,6 @@ const certManagerDeploymentNamespace = "cert-manager" // TestE2E checks configuration parameters (specified through flags) and then runs // E2E tests using the Ginkgo runner. func RunE2ETests(t *testing.T) { - logs.InitLogs() - defer logs.FlushLogs() - gomega.RegisterFailHandler(ginkgo.Fail) // Disable skipped tests unless they are explicitly requested. if config.GinkgoConfig.FocusString == "" && config.GinkgoConfig.SkipString == "" {