mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-01-19 03:05:53 +08:00
make json data printable
This commit is contained in:
parent
3839f96b44
commit
c98d65dcdb
@ -1,6 +1,7 @@
|
|||||||
package asynqmon
|
package asynqmon
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"time"
|
"time"
|
||||||
"unicode"
|
"unicode"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
@ -226,6 +227,9 @@ func isPrintable(data []byte) bool {
|
|||||||
if !utf8.Valid(data) {
|
if !utf8.Valid(data) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if json.Valid(data) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
isAllSpace := true
|
isAllSpace := true
|
||||||
for _, r := range string(data) {
|
for _, r := range string(data) {
|
||||||
if !unicode.IsPrint(r) {
|
if !unicode.IsPrint(r) {
|
||||||
|
Loading…
Reference in New Issue
Block a user