func (w *LogWriter) Write(data []byte) (int, error) {
	w.finLk.RLock()
	defer w.finLk.RUnlock()
	if w.closed {
		return len(data), nil
	}
	if w.msgCh == nil {
		return len(data), w.write(data)
	}
	copied := make([]byte, len(data))
	copy(copied, data)
	w.msgCh <- copied
	return len(data), nil
}
func (w *LogWriter) Write(data []byte) (int, error) {
	w.finLk.RLock()
	defer w.finLk.RUnlock()
	if w.closed {
		return len(data), nil
	}
	if w.msgCh == nil {
		return len(data), w.write(data)
	}
	copied := make([]byte, len(data))
	copy(copied, data)
	w.msgCh <- copied
	return len(data), nil
}
func ( w * LogWriter ) Write ( data [ ] byte ) ( int , error ) { w . finLk . RLock ( ) defer w . finLk . RUnlock ( ) if w . closed { return len ( data ) , nil } if w . msgCh == nil { return len ( data ) , w . write ( data ) } copied := make ( [ ] byte , len ( data ) ) copy ( copied , data ) w . msgCh <- copied return len ( data ) , nil }
// Write writes and logs the data.
Write writes and logs the data .