(line *buffer.Buffer, extra []Field)
| 130 | } |
| 131 | |
| 132 | func (c consoleEncoder) writeContext(line *buffer.Buffer, extra []Field) { |
| 133 | context := c.jsonEncoder.Clone().(*jsonEncoder) |
| 134 | defer func() { |
| 135 | // putJSONEncoder assumes the buffer is still used, but we write out the buffer so |
| 136 | // we can free it. |
| 137 | context.buf.Free() |
| 138 | putJSONEncoder(context) |
| 139 | }() |
| 140 | |
| 141 | addFields(context, extra) |
| 142 | context.closeOpenNamespaces() |
| 143 | if context.buf.Len() == 0 { |
| 144 | return |
| 145 | } |
| 146 | |
| 147 | c.addSeparatorIfNecessary(line) |
| 148 | line.AppendByte('{') |
| 149 | line.Write(context.buf.Bytes()) |
| 150 | line.AppendByte('}') |
| 151 | } |
| 152 | |
| 153 | func (c consoleEncoder) addSeparatorIfNecessary(line *buffer.Buffer) { |
| 154 | if line.Len() > 0 { |
no test coverage detected