mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-20 03:51:40 -04:00
Merge from vscode 2c306f762bf9c3db82dc06c7afaa56ef46d72f79 (#14050)
* Merge from vscode 2c306f762bf9c3db82dc06c7afaa56ef46d72f79 * Fix breaks * Extension management fixes * Fix breaks in windows bundling * Fix/skip failing tests * Update distro * Add clear to nuget.config * Add hygiene task * Bump distro * Fix hygiene issue * Add build to hygiene exclusion * Update distro * Update hygiene * Hygiene exclusions * Update tsconfig * Bump distro for server breaks * Update build config * Update darwin path * Add done calls to notebook tests * Skip failing tests * Disable smoke tests
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
import { ILogService, LogLevel, AbstractLogService, ILoggerService, ILogger } from 'vs/platform/log/common/log';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IFileService, whenProviderRegistered } from 'vs/platform/files/common/files';
|
||||
import { ByteSize, FileOperationError, FileOperationResult, IFileService, whenProviderRegistered } from 'vs/platform/files/common/files';
|
||||
import { Queue } from 'vs/base/common/async';
|
||||
import { VSBuffer } from 'vs/base/common/buffer';
|
||||
import { dirname, joinPath, basename } from 'vs/base/common/resources';
|
||||
@@ -13,7 +13,7 @@ import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { BufferLogService } from 'vs/platform/log/common/bufferLog';
|
||||
|
||||
const MAX_FILE_SIZE = 1024 * 1024 * 5;
|
||||
const MAX_FILE_SIZE = 5 * ByteSize.MB;
|
||||
|
||||
export class FileLogService extends AbstractLogService implements ILogService {
|
||||
|
||||
@@ -87,7 +87,13 @@ export class FileLogService extends AbstractLogService implements ILogService {
|
||||
}
|
||||
|
||||
private async initialize(): Promise<void> {
|
||||
await this.fileService.createFile(this.resource);
|
||||
try {
|
||||
await this.fileService.createFile(this.resource);
|
||||
} catch (error) {
|
||||
if ((<FileOperationError>error).fileOperationResult !== FileOperationResult.FILE_MODIFIED_SINCE) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private _log(level: LogLevel, message: string): void {
|
||||
|
||||
@@ -419,23 +419,43 @@ export function getLogLevel(environmentService: IEnvironmentService): LogLevel {
|
||||
return LogLevel.Trace;
|
||||
}
|
||||
if (typeof environmentService.logLevel === 'string') {
|
||||
const logLevel = environmentService.logLevel.toLowerCase();
|
||||
switch (logLevel) {
|
||||
case 'trace':
|
||||
return LogLevel.Trace;
|
||||
case 'debug':
|
||||
return LogLevel.Debug;
|
||||
case 'info':
|
||||
return LogLevel.Info;
|
||||
case 'warn':
|
||||
return LogLevel.Warning;
|
||||
case 'error':
|
||||
return LogLevel.Error;
|
||||
case 'critical':
|
||||
return LogLevel.Critical;
|
||||
case 'off':
|
||||
return LogLevel.Off;
|
||||
const logLevel = parseLogLevel(environmentService.logLevel.toLowerCase());
|
||||
if (logLevel !== undefined) {
|
||||
return logLevel;
|
||||
}
|
||||
}
|
||||
return DEFAULT_LOG_LEVEL;
|
||||
}
|
||||
|
||||
export function parseLogLevel(logLevel: string): LogLevel | undefined {
|
||||
switch (logLevel) {
|
||||
case 'trace':
|
||||
return LogLevel.Trace;
|
||||
case 'debug':
|
||||
return LogLevel.Debug;
|
||||
case 'info':
|
||||
return LogLevel.Info;
|
||||
case 'warn':
|
||||
return LogLevel.Warning;
|
||||
case 'error':
|
||||
return LogLevel.Error;
|
||||
case 'critical':
|
||||
return LogLevel.Critical;
|
||||
case 'off':
|
||||
return LogLevel.Off;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function LogLevelToString(logLevel: LogLevel): string {
|
||||
switch (logLevel) {
|
||||
case LogLevel.Trace: return 'trace';
|
||||
case LogLevel.Debug: return 'debug';
|
||||
case LogLevel.Info: return 'info';
|
||||
case LogLevel.Warning: return 'warn';
|
||||
case LogLevel.Error: return 'error';
|
||||
case LogLevel.Critical: return 'critical';
|
||||
case LogLevel.Off: return 'off';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
import * as path from 'vs/base/common/path';
|
||||
import { ILogService, LogLevel, AbstractLogService } from 'vs/platform/log/common/log';
|
||||
import * as spdlog from 'spdlog';
|
||||
import { ByteSize } from 'vs/platform/files/common/files';
|
||||
|
||||
async function createSpdLogLogger(processName: string, logsFolder: string): Promise<spdlog.RotatingLogger | null> {
|
||||
// Do not crash if spdlog cannot be loaded
|
||||
@@ -13,7 +14,7 @@ async function createSpdLogLogger(processName: string, logsFolder: string): Prom
|
||||
const _spdlog = await import('spdlog');
|
||||
_spdlog.setAsyncMode(8192, 500);
|
||||
const logfilePath = path.join(logsFolder, `${processName}.log`);
|
||||
return _spdlog.createRotatingLoggerAsync(processName, logfilePath, 1024 * 1024 * 5, 6);
|
||||
return _spdlog.createRotatingLoggerAsync(processName, logfilePath, 5 * ByteSize.MB, 6);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user