hasTimestampHook reports whether the logger has a timestampHook installed, which would cause duplicate timestamp fields if we also emit record.Time.
()
| 75 | // hasTimestampHook reports whether the logger has a timestampHook installed, |
| 76 | // which would cause duplicate timestamp fields if we also emit record.Time. |
| 77 | func (h *SlogHandler) hasTimestampHook() bool { |
| 78 | for _, hook := range h.logger.hooks { |
| 79 | if _, ok := hook.(timestampHook); ok { |
| 80 | return true |
| 81 | } |
| 82 | } |
| 83 | return false |
| 84 | } |
| 85 | |
| 86 | // WithAttrs returns a new Handler with the given attributes pre-attached. |
| 87 | // These attributes will be included in every subsequent log record. |