microsoft/vscode-react-native

Public

mirrored from https://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
0.8.0

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/extension/log/LogHelper.ts

39lines · modeblame

0a68f8dbArtem Egorov8 years ago1// 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 {
9Trace = 0,
10Debug = 1,
11Info = 2,
12Warning = 3,
13Error = 4,
14None = 5,
15}
16
17export interface ILogger {
18log: (message: string, level: LogLevel) => void;
19info: (message: string) => void;
20warning: (message: string) => void;
21error: (errorMessage: string, error?: Error, stack?: boolean) => void;
22debug: (message: string) => void;
23logStream: (data: Buffer | String, stream?: NodeJS.WritableStream) => void;
24}
25
26export class LogHelper {
27public static get LOG_LEVEL(): LogLevel {
28return getLogLevel();
29}
30}
31
32function getLogLevel() {
33try {
34const SettingsHelper = require("../settingsHelper").SettingsHelper;
35return SettingsHelper.getLogLevel();
36} catch (err) { // Debugger context
37return LogLevel.Info; // Default
38}
39}