Sync flushes buffered data to the logger as a new log entry even if it doesn't contain a newline.
()
| 126 | // Sync flushes buffered data to the logger as a new log entry even if it |
| 127 | // doesn't contain a newline. |
| 128 | func (w *Writer) Sync() error { |
| 129 | // Don't allow empty messages on explicit Sync calls or on Close |
| 130 | // because we don't want an extraneous empty message at the end of the |
| 131 | // stream -- it's common for files to end with a newline. |
| 132 | w.flush(false /* allowEmpty */) |
| 133 | return nil |
| 134 | } |
| 135 | |
| 136 | // flush flushes the buffered data to the logger, allowing empty messages only |
| 137 | // if the bool is set. |