Start implementing a logger
This commit is contained in:
parent
40fd1d5300
commit
557b4dce44
@ -192,8 +192,8 @@ func (e *EnvironmentsServer) Get(ctx context.Context, in *proto.GetOptions) (*pr
|
||||
}
|
||||
|
||||
func (e *EnvironmentsServer) List(in *proto.ListOptions, stream proto.Environments_ListServer) error {
|
||||
log := e.logInstance
|
||||
log.WithValues("user_id", in.GetOwnerId().GetUuid())
|
||||
logInstance := e.logInstance
|
||||
log := logInstance.WithValues("user_id", in.GetOwnerId().GetUuid())
|
||||
ctx := logr.NewContext(stream.Context(), log)
|
||||
|
||||
environment := &controllers.Environemnt{
|
||||
|
14
main.go
14
main.go
@ -52,11 +52,6 @@ func main() {
|
||||
|
||||
func server(params Serve) error {
|
||||
// Make sure the download dir exists
|
||||
if err := os.MkdirAll(params.DownloadDir, 0777); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Init a logger
|
||||
var log logr.Logger
|
||||
|
||||
zapLog, err := zap.NewDevelopment()
|
||||
@ -64,10 +59,17 @@ func server(params Serve) error {
|
||||
panic(fmt.Sprintf("who watches the watchmen (%v)?", err))
|
||||
}
|
||||
log = zapr.NewLogger(zapLog)
|
||||
log.Info("enabled")
|
||||
|
||||
if err := os.MkdirAll(params.DownloadDir, 0777); err != nil {
|
||||
log.Error(err, "Coulnd't create a download dir")
|
||||
return err
|
||||
}
|
||||
|
||||
// Init a logger
|
||||
|
||||
controller, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{})
|
||||
if err != nil {
|
||||
log.Error(err, "Coulnd't start a kube manager")
|
||||
return err
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user