12345678910111213141516171819202122232425262728293031323334353637383940 |
- Object.defineProperty(exports, '__esModule', { value: true });
- // Note: Ideally the `SeverityLevel` type would be derived from `validSeverityLevels`, but that would mean either
- //
- // a) moving `validSeverityLevels` to `@sentry/types`,
- // b) moving the`SeverityLevel` type here, or
- // c) importing `validSeverityLevels` from here into `@sentry/types`.
- //
- // Option A would make `@sentry/types` a runtime dependency of `@sentry/utils` (not good), and options B and C would
- // create a circular dependency between `@sentry/types` and `@sentry/utils` (also not good). So a TODO accompanying the
- // type, reminding anyone who changes it to change this list also, will have to do.
- const validSeverityLevels = ['fatal', 'error', 'warning', 'log', 'info', 'debug'];
- /**
- * Converts a string-based level into a member of the deprecated {@link Severity} enum.
- *
- * @deprecated `severityFromString` is deprecated. Please use `severityLevelFromString` instead.
- *
- * @param level String representation of Severity
- * @returns Severity
- */
- function severityFromString(level) {
- return severityLevelFromString(level) ;
- }
- /**
- * Converts a string-based level into a `SeverityLevel`, normalizing it along the way.
- *
- * @param level String representation of desired `SeverityLevel`.
- * @returns The `SeverityLevel` corresponding to the given string, or 'log' if the string isn't a valid level.
- */
- function severityLevelFromString(level) {
- return (level === 'warn' ? 'warning' : validSeverityLevels.includes(level) ? level : 'log') ;
- }
- exports.severityFromString = severityFromString;
- exports.severityLevelFromString = severityLevelFromString;
- exports.validSeverityLevels = validSeverityLevels;
- //# sourceMappingURL=severity.js.map
|