From c58651137c76958bd8fa87bb0aaa9ece9f8c35aa Mon Sep 17 00:00:00 2001 From: Chin-Ya Huang Date: Fri, 14 Apr 2023 10:29:35 +0800 Subject: [PATCH] style: capitalize first word in log messages Signed-off-by: Chin-Ya Huang --- pkg/manager/agent.go | 2 +- pkg/manager/cluster.go | 2 +- pkg/manager/collectors/harvester.go | 4 ++-- pkg/manager/httpserver.go | 2 +- pkg/manager/manager.go | 10 +++++----- pkg/simulator/objects/process_node_zips.go | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pkg/manager/agent.go b/pkg/manager/agent.go index ee25f174e..bfe0c6d1b 100644 --- a/pkg/manager/agent.go +++ b/pkg/manager/agent.go @@ -23,7 +23,7 @@ func (a *AgentDaemonSet) getDaemonSetName() string { func (a *AgentDaemonSet) Create(image string, managerURL string) (*appsv1.DaemonSet, error) { dsName := a.getDaemonSetName() - logrus.Debugf("creating daemonset %s with image %s", dsName, image) + logrus.Debugf("Creating daemonset %s with image %s", dsName, image) // get manager pod for owner reference labels := fmt.Sprintf("app=%s,%s=%s", types.SupportBundleManager, types.SupportBundleLabelKey, a.sbm.BundleName) diff --git a/pkg/manager/cluster.go b/pkg/manager/cluster.go index a2f3c6765..d400ac9f3 100644 --- a/pkg/manager/cluster.go +++ b/pkg/manager/cluster.go @@ -32,7 +32,7 @@ func NewCluster(ctx context.Context, sbm *SupportBundleManager) *Cluster { } func (c *Cluster) GenerateClusterBundle(bundleDir string) (string, error) { - logrus.Debug("generating cluster bundle...") + logrus.Debug("Generating cluster bundle...") namespace, err := c.sbm.k8s.GetNamespace(c.sbm.PodNamespace) if err != nil { return "", errors.Wrap(err, "cannot get deployed namespace") diff --git a/pkg/manager/collectors/harvester.go b/pkg/manager/collectors/harvester.go index fa66e79cb..9779c118a 100644 --- a/pkg/manager/collectors/harvester.go +++ b/pkg/manager/collectors/harvester.go @@ -52,12 +52,12 @@ func (module harvesterModule) toObj(b []byte, groupVersion, kind string, resourc switch resource { case "secrets": currentItems, _ := jsonParsed.S("items").Data().([]interface{}) - logrus.Debugf("whole items: %v", currentItems) + logrus.Debugf("Whole items: %v", currentItems) var newItems []interface{} for _, item := range currentItems { gItem := gabs.Wrap(item) if find := gItem.S("type").Data().(string) == "rke.cattle.io/machine-plan"; find { - logrus.Debugf("prepare to append item: %v", gItem.Data().(map[string]interface{})) + logrus.Debugf("Prepare to append item: %v", gItem.Data().(map[string]interface{})) newItems = append(newItems, item) } } diff --git a/pkg/manager/httpserver.go b/pkg/manager/httpserver.go index c05801fed..2ea62724a 100644 --- a/pkg/manager/httpserver.go +++ b/pkg/manager/httpserver.go @@ -64,7 +64,7 @@ func (s *HttpServer) createNodeBundle(w http.ResponseWriter, req *http.Request) return } - logrus.Debugf("handle create node bundle for %s", node) + logrus.Debugf("Handle create node bundle for %s", node) nodesDir := filepath.Join(s.manager.getWorkingDir(), "nodes") err := os.MkdirAll(nodesDir, os.FileMode(0775)) if err != nil { diff --git a/pkg/manager/manager.go b/pkg/manager/manager.go index cc20ccb99..e15996fc2 100644 --- a/pkg/manager/manager.go +++ b/pkg/manager/manager.go @@ -134,7 +134,7 @@ func (m *SupportBundleManager) Run() error { m.status.SetPhase(phase.Name) if err := phase.Run(); err != nil { m.status.SetError(err.Error()) - logrus.Errorf("failed to run phase %s: %s", phase.Name, err.Error()) + logrus.Errorf("Failed to run phase %s: %s", phase.Name, err.Error()) break } @@ -210,7 +210,7 @@ func (m *SupportBundleManager) phaseCollectNodeBundles() error { if err != nil { // Ignore error here, since in some failure cases we might not receive all node bundles. // A support bundle with partital data is also useful. - logrus.Error(err) + logrus.WithError(err).Error("Failed to collect node bundles") } return nil } @@ -295,15 +295,15 @@ func (m *SupportBundleManager) completeNode(node string) { _, ok := m.expectedNodes[node] if ok { - logrus.Debugf("complete node %s", node) + logrus.Debugf("Complete node %s", node) delete(m.expectedNodes, node) } else { - logrus.Warnf("complete an unknown node %s", node) + logrus.Warnf("Complete an unknown node %s", node) } if len(m.expectedNodes) == 0 { if !m.done { - logrus.Debugf("all nodes are completed.") + logrus.Debugf("All nodes are completed") m.ch <- struct{}{} m.done = true } diff --git a/pkg/simulator/objects/process_node_zips.go b/pkg/simulator/objects/process_node_zips.go index d92184786..323ef6b6f 100644 --- a/pkg/simulator/objects/process_node_zips.go +++ b/pkg/simulator/objects/process_node_zips.go @@ -228,7 +228,7 @@ func walkZipFiles(zipFile string) (*v1.Pod, *bundlekit.NodeConfig, error) { } nConfig.Spec = nodeConfigSpec if len(containers) == 0 { - logrus.Warnf("no pod being created for node %s as zip file has no log files associated with this node", filepath.Base(nodeName[0])) + logrus.Warnf("No pod being created for node %s as zip file has no log files associated with this node", filepath.Base(nodeName[0])) return nil, nConfig, nil } pod.Spec.Containers = containers