Store diagnostics in language-specific database

This commit is contained in:
Michael B. Gale 2023-10-05 13:39:58 +01:00
parent 4154eb799b
commit a144bf5d7f
No known key found for this signature in database
GPG key ID: FF5E2765BD00628F
6 changed files with 15 additions and 7 deletions

5
lib/diagnostics.js generated
View file

@ -7,6 +7,7 @@ exports.addDiagnostic = exports.makeDiagnostic = void 0;
const fs_1 = require("fs");
const path_1 = __importDefault(require("path"));
const logging_1 = require("./logging");
const util_1 = require("./util");
/**
* Constructs a new diagnostic message with the specified id and name, as well as optional additional data.
*
@ -29,9 +30,9 @@ exports.makeDiagnostic = makeDiagnostic;
* @param config The configuration that tells us where to store the diagnostic.
* @param diagnostic The diagnostic message to add to the database.
*/
function addDiagnostic(config, diagnostic) {
function addDiagnostic(config, language, diagnostic) {
const logger = (0, logging_1.getActionsLogger)();
const diagnosticsPath = path_1.default.resolve(config.dbLocation, "diagnostic", "codeql-action");
const diagnosticsPath = path_1.default.resolve((0, util_1.getCodeQLDatabasePath)(config, language), "diagnostic", "codeql-action");
// Create the directory if it doesn't exist yet.
(0, fs_1.mkdirSync)(diagnosticsPath, { recursive: true });
const jsonPath = path_1.default.resolve(diagnosticsPath, `codeql-action-${diagnostic.timestamp}.json`);