You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

28 lines
585 B

  1. // +build !windows
  2. package colorable
  3. import (
  4. "io"
  5. "os"
  6. )
  7. // NewColorable return new instance of Writer which handle escape sequence.
  8. func NewColorable(file *os.File) io.Writer {
  9. if file == nil {
  10. panic("nil passed instead of *os.File to NewColorable()")
  11. }
  12. return file
  13. }
  14. // NewColorableStdout return new instance of Writer which handle escape sequence for stdout.
  15. func NewColorableStdout() io.Writer {
  16. return os.Stdout
  17. }
  18. // NewColorableStderr return new instance of Writer which handle escape sequence for stderr.
  19. func NewColorableStderr() io.Writer {
  20. return os.Stderr
  21. }