Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Observability and Debuggability OSS Project Code #190

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Next Next commit
Modifed zap options to write to a test file
  • Loading branch information
rrajpuro committed Nov 16, 2023
commit a73707e2e15058afa82870fa38a1be2f38cc7e40
13 changes: 13 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@ package main

import (
"flag"
"log"
"os"

// Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
@@ -64,9 +65,21 @@ func main() {
flag.BoolVar(&enableLeaderElection, "leader-elect", false,
"Enable leader election for controller manager. "+
"Enabling this will ensure there is only one active controller manager.")

// Set the log file path
logFilePath := "./test1_logging.txt"

// Create a file for logging
logFile, err := os.Create(logFilePath)
if err != nil {
log.Fatalf("Error creating log file: %v", err)
}
defer logFile.Close()

opts := zap.Options{
Development: true,
TimeEncoder: zapcore.RFC3339TimeEncoder,
DestWriter: logFile, // Configure Zap options to write to the logFile
}
opts.BindFlags(flag.CommandLine)
flag.Parse()