feat: allow to export logs
Signed-off-by: huanggze <loganhuang@yunify.com>
This commit is contained in:
@@ -14,12 +14,17 @@ limitations under the License.
|
||||
package stringutils
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"strings"
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/asaskevich/govalidator"
|
||||
)
|
||||
|
||||
const ansi = "[\u001B\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"
|
||||
|
||||
var re = regexp.MustCompile(ansi)
|
||||
|
||||
// Creates an slice of slice values not included in the other given slice.
|
||||
func Diff(base, exclude []string) (result []string) {
|
||||
excludeMap := make(map[string]bool)
|
||||
@@ -83,3 +88,7 @@ func Split(str string, sep string) []string {
|
||||
}
|
||||
return strings.Split(str, sep)
|
||||
}
|
||||
|
||||
func StripAnsi(str string) string {
|
||||
return re.ReplaceAllString(str, "")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user