The change to flow logging to plugins is nice, however, it can be annoying because all writes to stderr are interepreted on the Lumi side as errors. After this change, we will only flow if --logflow is passed, e.g. as in $ lumi --logtostderr --logflow -v=9 deploy ...
54 lines
1.9 KiB
Go
54 lines
1.9 KiB
Go
// Licensed to Pulumi Corporation ("Pulumi") under one or more
|
|
// contributor license agreements. See the NOTICE file distributed with
|
|
// this work for additional information regarding copyright ownership.
|
|
// Pulumi licenses this file to You 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 main
|
|
|
|
import (
|
|
"github.com/golang/glog"
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/pulumi/lumi/pkg/util/cmdutil"
|
|
)
|
|
|
|
func NewLumiCmd() *cobra.Command {
|
|
var logFlow bool
|
|
var logToStderr bool
|
|
var verbose int
|
|
cmd := &cobra.Command{
|
|
Use: "lumi",
|
|
Short: "Lumi is a framework and toolset for reusable stacks of services",
|
|
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
|
cmdutil.InitLogging(logToStderr, verbose, logFlow)
|
|
},
|
|
PersistentPostRun: func(cmd *cobra.Command, args []string) {
|
|
glog.Flush()
|
|
},
|
|
}
|
|
|
|
cmd.PersistentFlags().BoolVar(&logFlow, "logflow", false, "Flow log settings to child processes (like plugins)")
|
|
cmd.PersistentFlags().BoolVar(&logToStderr, "logtostderr", false, "Log to stderr instead of to files")
|
|
cmd.PersistentFlags().IntVarP(
|
|
&verbose, "verbose", "v", 0, "Enable verbose logging (e.g., v=3); anything >3 is very verbose")
|
|
|
|
cmd.AddCommand(newConfigCmd())
|
|
cmd.AddCommand(newDeployCmd())
|
|
cmd.AddCommand(newDestroyCmd())
|
|
cmd.AddCommand(newEnvCmd())
|
|
cmd.AddCommand(newPackCmd())
|
|
cmd.AddCommand(newPlanCmd())
|
|
cmd.AddCommand(newVersionCmd())
|
|
|
|
return cmd
|
|
}
|