Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4. "fmt"
  5. "strings"
  6. )
  7.  
  8. func main() {
  9. logger := NewLogger(UsLogger)
  10. logger.Debug("hello")
  11. }
  12.  
  13. type Log func(info string) string
  14.  
  15. type Print interface {
  16. Debug(info string)
  17. }
  18.  
  19. func (log Log) Debug(info string) {
  20. fmt.Println("debug level:", log(info))
  21. }
  22.  
  23. func NewLogger(log Log) Print {
  24. return log
  25. }
  26.  
  27. func UsLogger(info string) string {
  28. return strings.ToUpper(info)
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement