github.com/zhongdalu/gf@v1.0.0/g/os/glog/glog_logger_writer.go (about)

     1  // Copyright 2017 gf Author(https://github.com/zhongdalu/gf). All Rights Reserved.
     2  //
     3  // This Source Code Form is subject to the terms of the MIT License.
     4  // If a copy of the MIT was not distributed with this file,
     5  // You can obtain one at https://github.com/zhongdalu/gf.
     6  
     7  package glog
     8  
     9  import "bytes"
    10  
    11  // Write implements the io.Writer interface.
    12  // It just prints the content using Print.
    13  func (l *Logger) Write(p []byte) (n int, err error) {
    14  	l.Header(false).Print(string(bytes.TrimRight(p, "\r\n")))
    15  	return len(p), nil
    16  }