os_function.go 481 B

1234567891011121314151617181920212223242526
  1. package lumberjack_afero
  2. import (
  3. "errors"
  4. "github.com/spf13/afero"
  5. "os"
  6. "path/filepath"
  7. )
  8. // To make sure no 'os' package used in lumberjack_afero.go,
  9. // that we can easily check no filesystem access by 'os' package.
  10. const (
  11. O_CREATE = os.O_CREATE
  12. O_WRONLY = os.O_WRONLY
  13. O_TRUNC = os.O_TRUNC
  14. O_APPEND = os.O_APPEND
  15. )
  16. func getProcessName() string {
  17. return filepath.Base(os.Args[0])
  18. }
  19. func IsNotExist(err error) bool {
  20. return errors.Is(err, afero.ErrFileNotFound)
  21. }