Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/baseConnector.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Validator, GenericResult, InitResult, CallResult, HangupResult, HoldTog
ParticipantResult, RecordingToggleResult, AgentConfigResult, ActiveCallsResult, SignedRecordingUrlResult, LogoutResult,
VendorConnector, Contact, AudioStats, SuperviseCallResult, SupervisorHangupResult, AgentStatusInfo} from './types';
import { enableMos, getMOS, initAudioStats, updateAudioStats } from './mosUtil';
import { log } from './logger';
import { getLogs, log } from './logger';

let channelPort;
let vendorConnector;
Expand Down Expand Up @@ -478,7 +478,7 @@ async function channelMessageHandler(message) {
}
break;
case constants.MESSAGE_TYPE.DOWNLOAD_VENDOR_LOGS:
vendorConnector.downloadLogs();
vendorConnector.downloadLogs(getLogs());
break;
case constants.MESSAGE_TYPE.LOG: {
const { logLevel, logMessage, payload } = message.data;
Expand Down
2 changes: 1 addition & 1 deletion src/main/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ export class VendorConnector {
/**
* Triggers a browser download for Vendor Logs
*/
downloadLogs() {
downloadLogs(logs) {
downloadLogs();
}

Expand Down
13 changes: 12 additions & 1 deletion src/test/baseConnector.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { ActiveCallsResult, InitResult, CallResult, HoldToggleResult, GenericRes
AgentConfigResult, Phone, HangupResult, SignedRecordingUrlResult, LogoutResult, AudioStats, StatsInfo, AudioStatsElement, SuperviseCallResult, SupervisorHangupResult } from '../main/index';
import baseConstants from '../main/constants';

import { log } from '../main/logger';
import { log, getLogs } from '../main/logger';
jest.mock('../main/logger');

const constants = {
Expand Down Expand Up @@ -1505,6 +1505,17 @@ describe('SCVConnectorBase tests', () => {
fireMessage(constants.MESSAGE_TYPE.DOWNLOAD_VENDOR_LOGS);
expect(adapter.downloadLogs).toBeCalledTimes(1);
});
it('Should pass the saved logmessages to downloadLogs() when DOWNLOAD_VENDOR_LOGS is published', () => {
getLogs.mockImplementationOnce(() => [
'"2022-02-10T20:10:30.503Z|INFO|SYSTEM|{"eventType":"SETUP_CONNECTOR","payload":{}'
]
);
fireMessage(constants.MESSAGE_TYPE.DOWNLOAD_VENDOR_LOGS);
expect(adapter.downloadLogs).toBeCalledTimes(1);
expect(adapter.downloadLogs).toBeCalledWith([
'"2022-02-10T20:10:30.503Z|INFO|SYSTEM|{"eventType":"SETUP_CONNECTOR","payload":{}'
]);
});
});

describe('logMessageToVendor()', () => {
Expand Down
2 changes: 1 addition & 1 deletion ts-declaration/logger.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function log(logMessage: object, logLevel: string, logSource?: string): v
*
* @returns a deep copy of the logs array
*/
export function getLogs(): any;
export function getLogs(): string[];
/**
* Download the logs as a file
*/
Expand Down
2 changes: 1 addition & 1 deletion ts-declaration/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ export class VendorConnector {
/**
* Triggers a browser download for Vendor Logs
*/
downloadLogs(): void;
downloadLogs(logs: string[]): void;
/**
* Sends the logs with a logLevel and payload to the vendor connector.
* Does a no-op, if not implemented.
Expand Down