isStringSafe checks if a string is safe to append without escaping.
(val string)
| 179 | |
| 180 | // isStringSafe checks if a string is safe to append without escaping. |
| 181 | func (s *formatterJSON) isStringSafe(val string) bool { |
| 182 | for i := range len(val) { |
| 183 | if b := val[i]; b >= utf8.RuneSelf || !jsonSafeSet[b] { |
| 184 | return false |
| 185 | } |
| 186 | } |
| 187 | return true |
| 188 | } |
| 189 | |
| 190 | // appendTime appends a time value to the buffer. |
| 191 | func (s *formatterJSON) appendTime(val time.Time) { |