1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-15 16:10:06 +00:00

chore(*): improved session and job state logging

This commit is contained in:
Yury Shkoda
2021-01-12 17:26:57 +03:00
parent 5a2ee88cbc
commit 8f4d1c7aea
2 changed files with 16 additions and 7 deletions

View File

@@ -1126,9 +1126,9 @@ export class SASViyaApiClient {
postedJobState = jobState.trim() postedJobState = jobState.trim()
if (this.debug && postedJobState !== printedState) { if (this.debug && printedState !== postedJobState) {
console.log('Polling job status... \n') console.log('Polling job status...')
console.log(`Current state: ${postedJobState}\n`) console.log(`Current job state: ${postedJobState}`)
printedState = postedJobState printedState = postedJobState
} }

View File

@@ -23,6 +23,10 @@ export class SessionManager {
private currentContext: Context | null = null private currentContext: Context | null = null
private csrfToken: CsrfToken | null = null private csrfToken: CsrfToken | null = null
private _debug: boolean = false private _debug: boolean = false
private printedSessionState = {
printed: false,
state: ''
}
public get debug() { public get debug() {
return this._debug return this._debug
@@ -175,8 +179,10 @@ export class SessionManager {
sessionState === '' sessionState === ''
) { ) {
if (stateLink) { if (stateLink) {
if (this.debug) { if (this.debug && !this.printedSessionState.printed) {
console.log('Polling session status... \n') console.log('Polling session status...')
this.printedSessionState.printed = true
} }
const { result: state } = await this.requestSessionStatus<string>( const { result: state } = await this.requestSessionStatus<string>(
@@ -191,8 +197,11 @@ export class SessionManager {
sessionState = state.trim() sessionState = state.trim()
if (this.debug) { if (this.debug && this.printedSessionState.state !== sessionState) {
console.log(`Current state is '${sessionState}'\n`) console.log(`Current session state is '${sessionState}'`)
this.printedSessionState.state = sessionState
this.printedSessionState.printed = false
} }
// There is an internal error present in SAS Viya 3.5 // There is an internal error present in SAS Viya 3.5