Add kubernetes objects aware logger with zap (#2179)

Using controller-runtime zap integration which is aware of Kubernetesobjects and logs only name+namespace of the object when complete runtime.Object compatible type is given to logger.

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
Sanket Sudake
2021-08-31 18:38:14 +05:30
committed by GitHub
parent f195975bda
commit a1cbce810e
13 changed files with 130 additions and 104 deletions
+2 -10
View File
@@ -17,13 +17,11 @@ limitations under the License.
package main
import (
"log"
"github.com/docopt/docopt-go"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"github.com/fission/fission/pkg/info"
"github.com/fission/fission/pkg/utils/loggerfactory"
)
func getStringArgWithDefault(arg interface{}, defaultValue string) string {
@@ -35,13 +33,7 @@ func getStringArgWithDefault(arg interface{}, defaultValue string) string {
}
func main() {
config := zap.NewProductionConfig()
config.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
logger, err := config.Build()
if err != nil {
log.Fatalf("can't initialize zap logger: %v", err)
}
logger := loggerfactory.GetLogger()
defer logger.Sync()
usage := `Package to perform operations needed prior to fission installation