Skip to content

Commit

Permalink
feat: [159] Restored System and Server logs in VRDT OUTPUT
Browse files Browse the repository at this point in the history
Signed-off-by: Mihail Penchev (c) <[email protected]>
  • Loading branch information
bcpmihail committed Oct 10, 2024
1 parent b53c2c4 commit 6fe25e9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
10 changes: 6 additions & 4 deletions extension/src/client/command/RunAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ class ActionRunner {
}

this.logger.info(`Running workflow ${RUN_SCRIPT_WORKFLOW_ID} (vRO ${this.vroVersion})`)
const supportsSysLog = semver.gt(this.vroVersion, "7.3.1")
const params = [
{
name: "script",
Expand All @@ -293,7 +292,7 @@ class ActionRunner {
name: "printInOutput",
type: "boolean",
value: {
boolean: { value: !supportsSysLog }
boolean: { value: true }
}
}
]
Expand Down Expand Up @@ -416,6 +415,9 @@ abstract class FetchSysLogsStrategy extends FetchLogsStrategy {
protected abstract getLogMessages(): Promise<LogMessage[]>

async printMessages(): Promise<void> {
if (Logger.level === "off") {
return
}
const timestamp = Date.now() - 10000 // 10sec earlier
const logs = await this.getLogMessages()
logs.forEach(logMessage => {
Expand Down Expand Up @@ -455,7 +457,7 @@ class FetchLogsPre76 extends FetchSysLogsStrategy {
return this.restClient.getWorkflowLogsPre76(
RUN_SCRIPT_WORKFLOW_ID,
this.executionToken,
"debug",
Logger.level,
this.lastTimestamp
)
}
Expand All @@ -475,7 +477,7 @@ class FetchLogsPost76 extends FetchSysLogsStrategy {
return this.restClient.getWorkflowLogsPost76(
RUN_SCRIPT_WORKFLOW_ID,
this.executionToken,
"debug",
Logger.level,
this.lastTimestamp
)
}
Expand Down
7 changes: 7 additions & 0 deletions packages/node/vrdt-common/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ export default class Logger {
}
}

/**
* Configured log level.
*/
static get level(): LogLevel {
return Logger.logLevel
}

debug(message: string, data?: any): void {
if (this.channel && Logger.logLevel === "debug") {
this.channel.debug(this.format("DEBUG", message, data))
Expand Down
3 changes: 1 addition & 2 deletions packages/node/vrdt-common/src/rest/VroRestClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,7 @@ export class VroRestClient {
"GET",
`workflows/${workflowId}/executions/${executionId}/syslogs` +
`?conditions=severity=${severity}` +
`&conditions=timestamp${encodeURIComponent(">")}${timestamp}` +
"&conditions=type=system"
`&conditions=timestamp${encodeURIComponent(">")}${timestamp}` // + "&conditions=type=system"
)

const messages: LogMessage[] = []
Expand Down

0 comments on commit 6fe25e9

Please sign in to comment.