mirror of
https://github.com/coder/code-server.git
synced 2026-06-21 17:37:11 +02:00
Squashed 'lib/vscode/' content from commit e5a624b788
git-subtree-dir: lib/vscode git-subtree-split: e5a624b788d92b8d34d1392e4c4d9789406efe8f
This commit is contained in:
46
src/vs/base/common/severity.ts
Normal file
46
src/vs/base/common/severity.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
|
||||
enum Severity {
|
||||
Ignore = 0,
|
||||
Info = 1,
|
||||
Warning = 2,
|
||||
Error = 3
|
||||
}
|
||||
|
||||
namespace Severity {
|
||||
|
||||
const _error = 'error';
|
||||
const _warning = 'warning';
|
||||
const _warn = 'warn';
|
||||
const _info = 'info';
|
||||
|
||||
/**
|
||||
* Parses 'error', 'warning', 'warn', 'info' in call casings
|
||||
* and falls back to ignore.
|
||||
*/
|
||||
export function fromValue(value: string): Severity {
|
||||
if (!value) {
|
||||
return Severity.Ignore;
|
||||
}
|
||||
|
||||
if (strings.equalsIgnoreCase(_error, value)) {
|
||||
return Severity.Error;
|
||||
}
|
||||
|
||||
if (strings.equalsIgnoreCase(_warning, value) || strings.equalsIgnoreCase(_warn, value)) {
|
||||
return Severity.Warning;
|
||||
}
|
||||
|
||||
if (strings.equalsIgnoreCase(_info, value)) {
|
||||
return Severity.Info;
|
||||
}
|
||||
return Severity.Ignore;
|
||||
}
|
||||
}
|
||||
|
||||
export default Severity;
|
||||
Reference in New Issue
Block a user