Add Linux distribution version to debug logs
This commit is contained in:
parent
507986db92
commit
08e2716e6e
3 changed files with 32 additions and 4 deletions
|
@ -2415,7 +2415,8 @@ ipc.handle(
|
||||||
process.versions.node,
|
process.versions.node,
|
||||||
app.getVersion(),
|
app.getVersion(),
|
||||||
os.version(),
|
os.version(),
|
||||||
userAgent
|
userAgent,
|
||||||
|
OS.getLinuxName()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -42,7 +42,8 @@ const getHeader = (
|
||||||
nodeVersion: string,
|
nodeVersion: string,
|
||||||
appVersion: string,
|
appVersion: string,
|
||||||
osVersion: string,
|
osVersion: string,
|
||||||
userAgent: string
|
userAgent: string,
|
||||||
|
linuxVersion?: string
|
||||||
): string =>
|
): string =>
|
||||||
[
|
[
|
||||||
headerSection('System info', {
|
headerSection('System info', {
|
||||||
|
@ -52,6 +53,7 @@ const getHeader = (
|
||||||
Environment: getEnvironment(),
|
Environment: getEnvironment(),
|
||||||
'App version': appVersion,
|
'App version': appVersion,
|
||||||
'OS version': osVersion,
|
'OS version': osVersion,
|
||||||
|
...(linuxVersion && { 'Linux version': linuxVersion }),
|
||||||
}),
|
}),
|
||||||
headerSection('User info', user),
|
headerSection('User info', user),
|
||||||
headerSection('Capabilities', capabilities),
|
headerSection('Capabilities', capabilities),
|
||||||
|
@ -84,13 +86,21 @@ export function getLog(
|
||||||
nodeVersion: string,
|
nodeVersion: string,
|
||||||
appVersion: string,
|
appVersion: string,
|
||||||
osVersion: string,
|
osVersion: string,
|
||||||
userAgent: string
|
userAgent: string,
|
||||||
|
linuxVersion?: string
|
||||||
): string {
|
): string {
|
||||||
let header: string;
|
let header: string;
|
||||||
let body: string;
|
let body: string;
|
||||||
if (isFetchLogIpcData(data)) {
|
if (isFetchLogIpcData(data)) {
|
||||||
const { logEntries } = data;
|
const { logEntries } = data;
|
||||||
header = getHeader(data, nodeVersion, appVersion, osVersion, userAgent);
|
header = getHeader(
|
||||||
|
data,
|
||||||
|
nodeVersion,
|
||||||
|
appVersion,
|
||||||
|
osVersion,
|
||||||
|
userAgent,
|
||||||
|
linuxVersion
|
||||||
|
);
|
||||||
body = logEntries.map(formatLine).join('\n');
|
body = logEntries.map(formatLine).join('\n');
|
||||||
} else {
|
} else {
|
||||||
header = headerSectionTitle('Partial logs');
|
header = headerSectionTitle('Partial logs');
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import semver from 'semver';
|
import semver from 'semver';
|
||||||
|
import { readFileSync } from 'fs-extra';
|
||||||
|
|
||||||
function createIsPlatform(
|
function createIsPlatform(
|
||||||
platform: typeof process.platform,
|
platform: typeof process.platform,
|
||||||
|
@ -26,6 +27,7 @@ export type OSType = {
|
||||||
isLinux: (minVersion?: string) => boolean;
|
isLinux: (minVersion?: string) => boolean;
|
||||||
isMacOS: (minVersion?: string) => boolean;
|
isMacOS: (minVersion?: string) => boolean;
|
||||||
isWindows: (minVersion?: string) => boolean;
|
isWindows: (minVersion?: string) => boolean;
|
||||||
|
getLinuxName: () => string | undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function getOSFunctions(osRelease: string): OSType {
|
export function getOSFunctions(osRelease: string): OSType {
|
||||||
|
@ -57,6 +59,20 @@ export function getOSFunctions(osRelease: string): OSType {
|
||||||
return 'os-linux';
|
return 'os-linux';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getLinuxName = (): string | undefined => {
|
||||||
|
if (!isLinux()) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
const etcOsRelease = readFileSync('/etc/os-release', 'utf-8');
|
||||||
|
const match = etcOsRelease.match(/^PRETTY_NAME=(.+?)$/m);
|
||||||
|
if (!match) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
return match[1];
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
getClassName,
|
getClassName,
|
||||||
getName,
|
getName,
|
||||||
|
@ -64,5 +80,6 @@ export function getOSFunctions(osRelease: string): OSType {
|
||||||
isLinux,
|
isLinux,
|
||||||
isMacOS,
|
isMacOS,
|
||||||
isWindows,
|
isWindows,
|
||||||
|
getLinuxName,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue