mlog.go 588 B

12345678910111213141516171819202122232425262728293031
  1. // Package mlog implements log operations.
  2. package mlog
  3. import (
  4. "runtime"
  5. )
  6. // The plog is a public function combiation for other log objects.
  7. type plog struct {
  8. isopen bool
  9. }
  10. // GetCaller returns file name and line number at the third step of runtime.
  11. func (*plog) getCaller() (string, int) {
  12. _, file, line, ok := runtime.Caller(3)
  13. if !ok {
  14. file = "???"
  15. line = 0
  16. }
  17. return file, line
  18. }
  19. // Open makes log open.
  20. func (this *plog) Open() {
  21. this.isopen = true
  22. }
  23. // Close makes log close.
  24. func (this *plog) Close() {
  25. this.isopen = false
  26. }