Named adds a new path segment to the logger's name. Segments are joined by periods. By default, Loggers are unnamed.
(s string)
| 152 | // Named adds a new path segment to the logger's name. Segments are joined by |
| 153 | // periods. By default, Loggers are unnamed. |
| 154 | func (log *Logger) Named(s string) *Logger { |
| 155 | if s == "" { |
| 156 | return log |
| 157 | } |
| 158 | l := log.clone() |
| 159 | if log.name == "" { |
| 160 | l.name = s |
| 161 | } else { |
| 162 | l.name = strings.Join([]string{l.name, s}, ".") |
| 163 | } |
| 164 | return l |
| 165 | } |
| 166 | |
| 167 | // WithOptions clones the current Logger, applies the supplied Options, and |
| 168 | // returns the resulting Logger. It's safe to use concurrently. |