Deprecated prints a deprecation warning message. If the IMGPROXY_FAIL_ON_DEPRECATION environment variable is truthy, it prints an error message and exits the program.
(deprecation, replacement string, additional ...string)
| 68 | // If the IMGPROXY_FAIL_ON_DEPRECATION environment variable is truthy, |
| 69 | // it prints an error message and exits the program. |
| 70 | func Deprecated(deprecation, replacement string, additional ...string) { |
| 71 | msg := fmt.Sprintf("%s is deprecated, use %s instead", deprecation, replacement) |
| 72 | |
| 73 | if len(additional) > 0 { |
| 74 | msg += ". " + strings.Join(additional, ". ") |
| 75 | } |
| 76 | |
| 77 | shouldFail := false |
| 78 | IMGPROXY_FAIL_ON_DEPRECATION.Parse(&shouldFail) |
| 79 | |
| 80 | if shouldFail { |
| 81 | Fatal(msg) |
| 82 | } else { |
| 83 | slog.Warn(msg) |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | // Mute sets the default logger to a discard logger muting all log output |
| 88 | func Mute() { |