glog_logger_writer.go 510 B

12345678910111213141516
  1. // Copyright GoFrame Author(https://goframe.org). 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/gogf/gf.
  6. package glog
  7. import "bytes"
  8. // Write implements the io.Writer interface.
  9. // It just prints the content using Print.
  10. func (l *Logger) Write(p []byte) (n int, err error) {
  11. l.Header(false).Print(string(bytes.TrimRight(p, "\r\n")))
  12. return len(p), nil
  13. }