// logLine writes a complete line and moves the cursor to the beginning of the
// line.
//
// It returns the number of bytes "n" written to the sink and the error "err",
// if one was encountered.
772122
func (l *Logger) logLine(str string) (n int, err error) {
	padding := strings.Repeat(" ", maxInt(0, l.widthFn()-len(str)))

	return l.log(str + padding + "\r")
}
826444
func (as *Step) LogEnd(label string) {
	name, ok := as.logLines[label]
	if !ok {
		return
	}

	delete(as.logLines, label)
	as.s.Callbacks.StepLogEnd(as, name)
}
806043
func (ld *LineDelimiter) Flush() (err error) {
	lines := strings.Split(ld.buf.String(), "\n")
	for _, line := range lines {
		if _, err = ld.output.Write(ld.delimiter); err != nil {
			return
		}
		if _, err = ld.output.Write([]byte(line)); err != nil {
			return
		}
		if _, err = ld.output.Write(ld.delimiter); err != nil {
			return
		}
		if _, err = ld.output.Write([]byte("\n")); err != nil {
			return
		}
	}
	return
}
635686
func (c *client) LogPost(id int64, rc io.ReadCloser) error {
	uri := fmt.Sprintf(pathLogs, c.base, id)
	return c.post(uri, rc, nil)
}
830774
func writeLine(buf *bytes.Buffer, words ...string) {
	buf.WriteString(strings.Join(words, " ") + "\n")
}
165171
func (f *Logfile) Write(p []byte) (int, error) {
	f.Lock()
	defer f.Unlock()

	if !f.opened {
		return 0, fmt.Errorf("logfile closed")
	}

	return f.fd.Write(p)
}
103199
func (l *loop) logf(isError bool, format string, a ...interface{}) {
	if l.descr == "" {
		return
	}
	if isError {
		logger.Errorf(format, a...)
	} else {
		logger.Infof(format, a...)
	}
}
47248
func (s *Scroller) readLine() ([]byte, error) {
	for {
		slice, err := s.reader.ReadSlice(delimiter)
		if err == nil {
			if s.isValid(slice) {
				return slice, nil
			}
			continue
		}
		line := append([]byte(nil), slice...)
		for err == bufio.ErrBufferFull {
			slice, err = s.reader.ReadSlice(delimiter)
			line = append(line, slice...)
		}
		switch err {
		case nil:
			if s.isValid(line) {
				return line, nil
			}
		case io.EOF:
			// Reached EOF without a delimiter,
			// so step back for next time.
			s.source.Seek(-int64(len(line)), os.SEEK_CUR)
			return nil, err
		default:
			return nil, err
		}
	}
}
791440
func (svc *Service) logSink(f *os.File, r io.ReadCloser) {
	_, err := io.Copy(f, r)
	if err != nil {
		log.Warningf("Service %s - log sink failed: %v", svc.name, err)
	}
	f.Close()
	r.Close()
}
159032
func countLines(f *os.File) int {
	r := bufio.NewReader(f)
	count := 0
	var err error = nil
	for err == nil {
		prefix := true
		_, prefix, err = r.ReadLine()
		if err != nil {
		}
		// sometimes we don't get the whole line at once
		if !prefix && err == nil {
			count++
		}
	}
	return count
}
549024
func (writer *baseFileWriter) RotateLines() int {
	writer.lock.RLock()
	defer writer.lock.RUnlock()
	return writer.rotateLines
}
136452
func (l *lexer) newline() {
	// adjust the counters for the new line
	if l._previous == nil {
		l._previous = make([]int, 0)
	}
	l._previous = append(l._previous, l._column)
	l._column = 1
	l._line++
}
1219470
func Line(prompt string) (string, error) {
	ins := getInstance()
	ins.SetPrompt(prompt)
	return ins.Readline()
}
444150
func (l *LogFile) Close() error {
	l.writer.Flush()
	l.writer.Close()
	return l.file.Close()
}
966416
func (f *LogFile) appendEntry(e *LogEntry) error {
	// Marshal entry to the local buffer.
	f.buf = appendLogEntry(f.buf[:0], e)

	// Save the size of the record.
	e.Size = len(f.buf)

	// Write record to file.
	n, err := f.w.Write(f.buf)
	if err != nil {
		// Move position backwards over partial entry.
		// Log should be reopened if seeking cannot be completed.
		if n > 0 {
			f.w.Reset(f.file)
			if _, err := f.file.Seek(int64(-n), io.SeekCurrent); err != nil {
				f.Close()
			}
		}
		return err
	}

	// Update in-memory file size & modification time.
	f.size += int64(n)
	f.modTime = time.Now()

	return nil
}
1249961
func (c *CheckRunAnnotation) GetEndLine() int {
	if c == nil || c.EndLine == nil {
		return 0
	}
	return *c.EndLine
}
1099266
func (p *SeriesPartition) writeLogEntry(data []byte) (offset int64, err error) {
	segment := p.activeSegment()
	if segment == nil || !segment.CanWrite(data) {
		if segment, err = p.createSegment(); err != nil {
			return 0, err
		}
	}
	return segment.WriteLogEntry(data)
}