Remove pkg/logs package

Signed-off-by: James Munnelly <james@munnelly.eu>
This commit is contained in:
James Munnelly 2018-10-15 12:28:47 +01:00
parent 500957f37e
commit b6f854f849
7 changed files with 0 additions and 99 deletions

View File

@ -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",

View File

@ -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",

View File

@ -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)

View File

@ -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"],
)

View File

@ -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)
}

View File

@ -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",

View File

@ -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 == "" {