2017-08-11 19:19:46 +02:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Copyright 2017 gRPC authors.
|
|
|
|
*
|
|
|
|
* 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 grpclog defines logging for grpc.
|
|
|
|
//
|
2019-09-09 14:04:58 +02:00
|
|
|
// All logs in transport and grpclb packages only go to verbose level 2.
|
2017-08-11 19:19:46 +02:00
|
|
|
// All logs in other packages in grpc are logged in spite of the verbosity level.
|
|
|
|
//
|
|
|
|
// In the default logger,
|
|
|
|
// severity level can be set by environment variable GRPC_GO_LOG_SEVERITY_LEVEL,
|
|
|
|
// verbosity level can be set by GRPC_GO_LOG_VERBOSITY_LEVEL.
|
|
|
|
package grpclog // import "google.golang.org/grpc/grpclog"
|
|
|
|
|
|
|
|
import "os"
|
|
|
|
|
|
|
|
var logger = newLoggerV2()
|
|
|
|
|
|
|
|
// V reports whether verbosity level l is at least the requested verbose level.
|
|
|
|
func V(l int) bool {
|
|
|
|
return logger.V(l)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Info logs to the INFO log.
|
|
|
|
func Info(args ...interface{}) {
|
|
|
|
logger.Info(args...)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Infof logs to the INFO log. Arguments are handled in the manner of fmt.Printf.
|
|
|
|
func Infof(format string, args ...interface{}) {
|
|
|
|
logger.Infof(format, args...)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Infoln logs to the INFO log. Arguments are handled in the manner of fmt.Println.
|
|
|
|
func Infoln(args ...interface{}) {
|
|
|
|
logger.Infoln(args...)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Warning logs to the WARNING log.
|
|
|
|
func Warning(args ...interface{}) {
|
|
|
|
logger.Warning(args...)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Warningf logs to the WARNING log. Arguments are handled in the manner of fmt.Printf.
|
|
|
|
func Warningf(format string, args ...interface{}) {
|
|
|
|
logger.Warningf(format, args...)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Warningln logs to the WARNING log. Arguments are handled in the manner of fmt.Println.
|
|
|
|
func Warningln(args ...interface{}) {
|
|
|
|
logger.Warningln(args...)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Error logs to the ERROR log.
|
|
|
|
func Error(args ...interface{}) {
|
|
|
|
logger.Error(args...)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Errorf logs to the ERROR log. Arguments are handled in the manner of fmt.Printf.
|
|
|
|
func Errorf(format string, args ...interface{}) {
|
|
|
|
logger.Errorf(format, args...)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Errorln logs to the ERROR log. Arguments are handled in the manner of fmt.Println.
|
|
|
|
func Errorln(args ...interface{}) {
|
|
|
|
logger.Errorln(args...)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Fatal logs to the FATAL log. Arguments are handled in the manner of fmt.Print.
|
|
|
|
// It calls os.Exit() with exit code 1.
|
|
|
|
func Fatal(args ...interface{}) {
|
|
|
|
logger.Fatal(args...)
|
|
|
|
// Make sure fatal logs will exit.
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Fatalf logs to the FATAL log. Arguments are handled in the manner of fmt.Printf.
|
command: Unmanaged providers
This adds supports for "unmanaged" providers, or providers with process
lifecycles not controlled by Terraform. These providers are assumed to
be started before Terraform is launched, and are assumed to shut
themselves down after Terraform has finished running.
To do this, we must update the go-plugin dependency to v1.3.0, which
added support for the "test mode" plugin serving that powers all this.
As a side-effect of not needing to manage the process lifecycle anymore,
Terraform also no longer needs to worry about the provider's binary, as
it won't be used for anything anymore. Because of this, we can disable
the init behavior that concerns itself with downloading that provider's
binary, checking its version, and otherwise managing the binary.
This is all managed on a per-provider basis, so managed providers that
Terraform downloads, starts, and stops can be used in the same commands
as unmanaged providers. The TF_REATTACH_PROVIDERS environment variable
is added, and is a JSON encoding of the provider's address to the
information we need to connect to it.
This change enables two benefits: first, delve and other debuggers can
now be attached to provider server processes, and Terraform can connect.
This allows for attaching debuggers to provider processes, which before
was difficult to impossible. Second, it allows the SDK test framework to
host the provider in the same process as the test driver, while running
a production Terraform binary against the provider. This allows for Go's
built-in race detector and test coverage tooling to work as expected in
provider tests.
Unmanaged providers are expected to work in the exact same way as
managed providers, with one caveat: Terraform kills provider processes
and restarts them once per graph walk, meaning multiple times during
most Terraform CLI commands. As unmanaged providers can't be killed by
Terraform, and have no visibility into graph walks, unmanaged providers
are likely to have differences in how their global mutable state behaves
when compared to managed providers. Namely, unmanaged providers are
likely to retain global state when managed providers would have reset
it. Developers relying on global state should be aware of this.
2020-05-27 02:48:57 +02:00
|
|
|
// It calls os.Exit() with exit code 1.
|
2017-08-11 19:19:46 +02:00
|
|
|
func Fatalf(format string, args ...interface{}) {
|
|
|
|
logger.Fatalf(format, args...)
|
|
|
|
// Make sure fatal logs will exit.
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Fatalln logs to the FATAL log. Arguments are handled in the manner of fmt.Println.
|
|
|
|
// It calle os.Exit()) with exit code 1.
|
|
|
|
func Fatalln(args ...interface{}) {
|
|
|
|
logger.Fatalln(args...)
|
|
|
|
// Make sure fatal logs will exit.
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Print prints to the logger. Arguments are handled in the manner of fmt.Print.
|
2018-09-24 18:30:39 +02:00
|
|
|
//
|
2017-08-11 19:19:46 +02:00
|
|
|
// Deprecated: use Info.
|
|
|
|
func Print(args ...interface{}) {
|
|
|
|
logger.Info(args...)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Printf prints to the logger. Arguments are handled in the manner of fmt.Printf.
|
2018-09-24 18:30:39 +02:00
|
|
|
//
|
2017-08-11 19:19:46 +02:00
|
|
|
// Deprecated: use Infof.
|
|
|
|
func Printf(format string, args ...interface{}) {
|
|
|
|
logger.Infof(format, args...)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Println prints to the logger. Arguments are handled in the manner of fmt.Println.
|
2018-09-24 18:30:39 +02:00
|
|
|
//
|
2017-08-11 19:19:46 +02:00
|
|
|
// Deprecated: use Infoln.
|
|
|
|
func Println(args ...interface{}) {
|
|
|
|
logger.Infoln(args...)
|
|
|
|
}
|