microsoft/vscode-react-native

Public

mirrored fromhttps://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
0.6.9

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/extension/log/LogHelper.ts

39lines · modecode

1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT license. See LICENSE file in the project root for details.
3
4/**
5 * Logging utility class.
6 */
7
8export enum LogLevel {
9 Trace = 0,
10 Debug = 1,
11 Info = 2,
12 Warning = 3,
13 Error = 4,
14 None = 5,
15}
16
17export interface ILogger {
18 log: (message: string, level: LogLevel) => void;
19 info: (message: string) => void;
20 warning: (message: string) => void;
21 error: (errorMessage: string, error?: Error, stack?: boolean) => void;
22 debug: (message: string) => void;
23 logStream: (data: Buffer | String, stream?: NodeJS.WritableStream) => void;
24}
25
26export class LogHelper {
27 public static get LOG_LEVEL(): LogLevel {
28 return getLogLevel();
29 }
30}
31
32function getLogLevel() {
33 try {
34 const SettingsHelper = require("../settingsHelper").SettingsHelper;
35 return SettingsHelper.getLogLevel();
36 } catch (err) { // Debugger context
37 return LogLevel.Info; // Default
38 }
39}
40