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
+5 -13
View File
@@ -17,25 +17,17 @@ limitations under the License.
package main
import (
"log"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"github.com/fission/fission/cmd/fetcher/app"
"github.com/fission/fission/pkg/utils/loggerfactory"
"github.com/fission/fission/pkg/utils/profile"
)
// Usage: fetcher <shared volume path>
func main() {
profile.ProfileIfEnabled()
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()
profile.ProfileIfEnabled(logger)
app.Run(logger)
}