@@ -144,7 +144,7 @@ func parseConfig(stdin []byte) (*PluginConf, error) {
144144func cmdAdd (args * skel.CmdArgs ) error {
145145 conf , err := parseConfig (args .StdinData )
146146 if err != nil {
147- logrus .Errorf ( "error parsing config: %e" , err )
147+ logrus .WithError ( err ). Error ( "error parsing config" )
148148 return err
149149 }
150150 configureLoggingLevel (conf .LogLevel )
@@ -165,7 +165,7 @@ func cmdAdd(args *skel.CmdArgs) error {
165165 args .Args = strings .Replace (args .Args , "K8S_POD_NAMESPACE" , "K8sPodNamespace" , 1 )
166166 args .Args = strings .Replace (args .Args , "K8S_POD_NAME" , "K8sPodName" , 1 )
167167 if err := types .LoadArgs (args .Args , & k8sArgs ); err != nil {
168- logrus .Errorf ( "error loading args %e" , err )
168+ logrus .WithError ( err ). Error ( "error loading args" )
169169 return err
170170 }
171171
@@ -185,19 +185,19 @@ func cmdAdd(args *skel.CmdArgs) error {
185185
186186 config , err := clientcmd .NewNonInteractiveDeferredLoadingClientConfig (configLoadingRules , configOverrides ).ClientConfig ()
187187 if err != nil {
188- logrus .Errorf ( "linkerd-cni client err with NewNonInteractiveDeferredLoadingClientConfig: %e" , err )
188+ logrus .WithError ( err ). Error ( "linkerd-cni client err with NewNonInteractiveDeferredLoadingClientConfig" )
189189 return err
190190 }
191191
192192 client , err := kubernetes .NewForConfig (config )
193193 if err != nil {
194- logrus .Errorf ( "linkerd-cni client err with NewForConfig: %e" , err )
194+ logrus .WithError ( err ). Error ( "linkerd-cni client err with NewForConfig" )
195195 return err
196196 }
197197
198198 pod , err := client .CoreV1 ().Pods (namespace ).Get (ctx , podName , metav1.GetOptions {})
199199 if err != nil {
200- logrus .Errorf ( "linkerd-cni client err in client.Pods().Get(): %e" , err )
200+ logrus .WithError ( err ). Error ( "linkerd-cni client err in client.Pods().Get()" )
201201 return err
202202 }
203203
0 commit comments