Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added debug info dump button #153

Merged
merged 1 commit into from
Jul 25, 2023
Merged
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
36 changes: 36 additions & 0 deletions Project/src/MakeCall/MakeCall.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import CallSurvey from '../MakeCall/CallSurvey';
import Login from './Login';
import MediaConstraint from './MediaConstraint';
import { setLogLevel, AzureLogger } from '@azure/logger';
import { inflate } from 'pako';
export default class MakeCall extends React.Component {
constructor(props) {
super(props);
Expand Down Expand Up @@ -254,6 +255,35 @@ export default class MakeCall extends React.Component {
this.logBuffer = [];
}

downloadDebugInfoLogDump = async () => {
const date = new Date();
const fileName = `logs-${date.toISOString().slice(0, 19)}.txt`;
var element = document.createElement('a');
let newDebugInfo = null;
try {
let debugInfoFeature = this.callClient.feature(Features.DebugInfo);
let debugInfo = debugInfoFeature.dumpDebugInfo();
let debugInfoZippedDump = debugInfo.dump;
let debugInfoDumpId = debugInfo.dumpId;
newDebugInfo = {
lastCallId: debugInfoFeature.lastCallId,
lastLocalParticipantId: debugInfoFeature.lastLocalParticipantId,
debugInfoDumpId:debugInfoDumpId,
debugInfoDumpUnzipped: JSON.parse(inflate(debugInfoZippedDump, { to: 'string' })),
}
} catch (e) {
console.error('ERROR, failed to dumpDebugInfo', e);
}
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(JSON.stringify(newDebugInfo)));
element.setAttribute('download', fileName);

element.style.display = 'none';
document.body.appendChild(element);

element.click();
document.body.removeChild(element);
}

joinGroup = async (withVideo) => {
try {
const callOptions = await this.getCallOptions({video: withVideo, micMuted: false});
Expand Down Expand Up @@ -762,6 +792,12 @@ this.deviceManager.on('selectedSpeakerChanged', () => { console.log(this.deviceM
text={`Get Logs`}
onClick={this.downloadLog}>
</PrimaryButton>
<PrimaryButton
className="primary-button"
iconProps={{ iconName: 'Download', style: { verticalAlign: 'middle', fontSize: 'large' } }}
text={`Get Debug Info Log Dump`}
onClick={this.downloadDebugInfoLogDump}>
</PrimaryButton>
<PrimaryButton
className="primary-button"
iconProps={{ iconName: 'TransferCall', style: { verticalAlign: 'middle', fontSize: 'large' } }}
Expand Down
Loading