func (l *Log) header(s Severity, depth int) (*buffer, string, int) {
	// Lmmdd hh:mm:ss.uuuuuu threadid file:line]
	now := timeNow()
	_, file, line, ok := runtime.Caller(l.skip + depth)
	if !ok {
		file = "???"
		line = 1
	} else {
		slash := strings.LastIndex(file, "/")
		if slash >= 0 {
			file = file[slash+1:]
		}
	}
	if line < 0 {
		line = 0 // not a real line number, but acceptable to someDigits
	}
	if s > FatalLog {
		s = InfoLog // for safety.
	}
	buf := l.getBuffer()

	// Avoid Fprintf, for speed. The format is so simple that we can do it quickly by hand.
	// It's worth about 3X. Fprintf is hard.
	_, month, day := now.Date()
	hour, minute, second := now.Clock()
	buf.tmp[0] = severityChar[s]
	buf.twoDigits(1, int(month))
	buf.twoDigits(3, day)
	buf.tmp[5] = ' '
	buf.twoDigits(6, hour)
	buf.tmp[8] = ':'
	buf.twoDigits(9, minute)
	buf.tmp[11] = ':'
	buf.twoDigits(12, second)
	buf.tmp[14] = '.'
	buf.nDigits(6, 15, now.Nanosecond()/1000, '0')
	buf.tmp[21] = ' '
	buf.nDigits(7, 22, pid, ' ') // TODO: should be TID
	buf.tmp[29] = ' '
	buf.Write(buf.tmp[:30])
	buf.WriteString(file)
	buf.tmp[0] = ':'
	n := buf.someDigits(1, line)
	buf.tmp[n+1] = ']'
	buf.tmp[n+2] = ' '
	buf.Write(buf.tmp[:n+3])
	return buf, file, line
}
func (l *Log) header(s Severity, depth int) (*buffer, string, int) {
	
	now := timeNow()
	_, file, line, ok := runtime.Caller(l.skip + depth)
	if !ok {
		file = "???"
		line = 1
	} else {
		slash := strings.LastIndex(file, "/")
		if slash >= 0 {
			file = file[slash+1:]
		}
	}
	if line < 0 {
		line = 0 
	}
	if s > FatalLog {
		s = InfoLog 
	}
	buf := l.getBuffer()

	
	
	_, month, day := now.Date()
	hour, minute, second := now.Clock()
	buf.tmp[0] = severityChar[s]
	buf.twoDigits(1, int(month))
	buf.twoDigits(3, day)
	buf.tmp[5] = ' '
	buf.twoDigits(6, hour)
	buf.tmp[8] = ':'
	buf.twoDigits(9, minute)
	buf.tmp[11] = ':'
	buf.twoDigits(12, second)
	buf.tmp[14] = '.'
	buf.nDigits(6, 15, now.Nanosecond()/1000, '0')
	buf.tmp[21] = ' '
	buf.nDigits(7, 22, pid, ' ') 
	buf.tmp[29] = ' '
	buf.Write(buf.tmp[:30])
	buf.WriteString(file)
	buf.tmp[0] = ':'
	n := buf.someDigits(1, line)
	buf.tmp[n+1] = ']'
	buf.tmp[n+2] = ' '
	buf.Write(buf.tmp[:n+3])
	return buf, file, line
}
func ( l * Log ) header ( s Severity , depth int ) ( * buffer , string , int ) { // Lmmdd hh:mm:ss.uuuuuu threadid file:line] now := timeNow ( ) _ , file , line , ok := runtime . Caller ( l . skip + depth ) if ! ok { file = " " line = 1 } else { slash := strings . LastIndex ( file , " " ) if slash >= 0 { file = file [ slash + 1 : ] } } if line < 0 { line = 0 // not a real line number, but acceptable to someDigits } if s > FatalLog { s = InfoLog // for safety. } buf := l . getBuffer ( ) // Avoid Fprintf, for speed. The format is so simple that we can do it quickly by hand. // It's worth about 3X. Fprintf is hard. _ , month , day := now . Date ( ) hour , minute , second := now . Clock ( ) buf . tmp [ 0 ] = severityChar [ s ] buf . twoDigits ( 1 , int ( month ) ) buf . twoDigits ( 3 , day ) buf . tmp [ 5 ] = ' ' buf . twoDigits ( 6 , hour ) buf . tmp [ 8 ] = ':' buf . twoDigits ( 9 , minute ) buf . tmp [ 11 ] = ':' buf . twoDigits ( 12 , second ) buf . tmp [ 14 ] = '.' buf . nDigits ( 6 , 15 , now . Nanosecond ( ) / 1000 , '0' ) buf . tmp [ 21 ] = ' ' buf . nDigits ( 7 , 22 , pid , ' ' ) // TODO: should be TID buf . tmp [ 29 ] = ' ' buf . Write ( buf . tmp [ : 30 ] ) buf . WriteString ( file ) buf . tmp [ 0 ] = ':' n := buf . someDigits ( 1 , line ) buf . tmp [ n + 1 ] = ']' buf . tmp [ n + 2 ] = ' ' buf . Write ( buf . tmp [ : n + 3 ] ) return buf , file , line }
/*
header formats a log header as defined by the C++ implementation.
It returns a buffer containing the formatted header.
The depth specifies how many stack frames above lives the source line to be identified in the log message.

Log lines have this form:
	Lmmdd hh:mm:ss.uuuuuu threadid file:line] msg...
where the fields are defined as follows:
	L                A single character, representing the log level (eg 'I' for INFO)
	mm               The month (zero padded; ie May is '05')
	dd               The day (zero padded)
	hh:mm:ss.uuuuuu  Time in hours, minutes and fractional seconds
	threadid         The space-padded thread ID as returned by GetTID()
	file             The file name
	line             The line number
	msg              The user-supplied message
*/
/ * header formats a log header as defined by the C ++ implementation . It returns a buffer containing the formatted header . The depth specifies how many stack frames above lives the source line to be identified in the log message .