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

the new methods remove the character huawei from the format string th… #1234

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions huaweicloud/utils/fmtp/errors.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package fmtp

import (
"fmt"
"strings"
)

func Errorf(format string, a ...interface{}) error {
newFormat := strings.Replace(format, REPLACE_STR, "", -1)
return fmt.Errorf(newFormat, a)
}
13 changes: 13 additions & 0 deletions huaweicloud/utils/fmtp/print.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package fmtp

import (
"fmt"
"strings"
)

const REPLACE_STR = "huawei"

func Sprintf(format string, a ...interface{}) string {
newFormat := strings.Replace(format, REPLACE_STR, "", -1)
return fmt.Sprintf(newFormat, a)
}
14 changes: 14 additions & 0 deletions huaweicloud/utils/logp/log.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package logp

import (
"log"
"strings"
)

const REPLACE_STR = "huawei"

func Printf(format string, v ...interface{}) {
newFormat := strings.Replace(format, REPLACE_STR, "", -1)
log.Printf(newFormat, v)

}