-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into users/nityagi/GeoExpansionSupport
- Loading branch information
Showing
8 changed files
with
312 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*/ | ||
|
||
export enum SeverityLevel { | ||
Low = 'Low', | ||
Medium = 'Medium', | ||
High = 'High', | ||
Critical = 'Critical', | ||
} | ||
|
||
export enum CustomEventModifier { | ||
Complete = 'Complete', | ||
Failure = 'Failure', | ||
Progress = 'Progress', | ||
Start = 'Start', | ||
} | ||
|
||
export enum EventType { | ||
Info = 'Information', | ||
Warning = 'Warning', | ||
Error = 'Error', | ||
} | ||
|
||
export enum CustomEventSubType { | ||
Load = 'Load', | ||
Create = 'Create', | ||
Update = 'Update', | ||
Delete = 'Delete', | ||
} | ||
|
||
export enum CustomType { | ||
/** | ||
* Defines a user action to track. | ||
*/ | ||
Action = 'Action', | ||
|
||
/** | ||
* Defines a custom event to track. | ||
*/ | ||
Custom = 'Custom', | ||
|
||
/** | ||
* Defines a scenario to track, that has a start, an end and duration. | ||
*/ | ||
Scenario = 'Scenario', | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*/ | ||
|
||
import {CustomEventModifier, CustomEventSubType, CustomType, EventType, SeverityLevel} from './EventContants'; | ||
import {IWebExtensionTelemetryData} from '../../web/client/telemetry/webExtensionTelemetryInterface'; | ||
import {IProDevCopilotTelemetryData} from '../copilot/telemetry/ITelemetry'; | ||
|
||
export interface IUserInfo { | ||
oid: string; | ||
tid: string; | ||
} | ||
|
||
export interface IEvent { | ||
eventName: string; | ||
eventType: EventType | string; | ||
eventMessage?: object; | ||
customDimension?: IWebExtensionTelemetryData| IProDevCopilotTelemetryData| object; // TODO: Use IPortalTelemetryData | ||
customMeasurements?: IWebExtensionTelemetryData| object; // TODO: Use IPortalTelemetryData | ||
eventSeverity?: SeverityLevel; | ||
correlationId?: string; | ||
} | ||
|
||
export interface ICustomEvent { | ||
customEventType: CustomType; | ||
customEventId?: string; | ||
customEventSubType? : CustomEventSubType; | ||
customEventModifier? : CustomEventModifier; | ||
} | ||
export interface IException { | ||
exceptionName?: string; | ||
exceptionStack?: string; | ||
exceptionSource?: string; | ||
exceptionCauseCode?: string | number; | ||
exceptionDetails?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*/ | ||
|
||
import { OneDSLogger } from "./oneDSLogger"; | ||
|
||
//// Wrapper class of oneDSLogger for below purposes | ||
//// 1. Abstracting code from manual trace log APIs. | ||
//// 2. Constrolling instantiation of 1ds SDK framework code in oneDSLogger.ts | ||
|
||
export class oneDSLoggerWrapper { | ||
private static instance: oneDSLoggerWrapper; | ||
private static oneDSLoggerIntance : OneDSLogger; | ||
|
||
private constructor(geo?: string) { | ||
oneDSLoggerWrapper.oneDSLoggerIntance = new OneDSLogger(geo); | ||
} | ||
|
||
|
||
static getLogger(){ | ||
return this.instance; | ||
} | ||
|
||
static instantiate(geo?:string){ | ||
if(!oneDSLoggerWrapper.instance) { | ||
oneDSLoggerWrapper.instance = new oneDSLoggerWrapper(geo); | ||
} | ||
return this.instance; | ||
} | ||
|
||
/// Trace info log | ||
public traceInfo(eventName:string, customDimension?:Record<string, string>, customMeasurement?: Record<string, number>, message?:string) { | ||
try{ | ||
oneDSLoggerWrapper.oneDSLoggerIntance.traceInfo(eventName, customDimension, customMeasurement, message); | ||
}catch (exception) { | ||
console.warn(exception); | ||
} | ||
} | ||
|
||
/// Trace warning log | ||
public traceWarning(eventName:string, customDimension?:Record<string, string>, customMeasurement?: Record<string, number>, message?:string) { | ||
try{ | ||
oneDSLoggerWrapper.oneDSLoggerIntance.traceWarning(eventName, customDimension, customMeasurement, message); | ||
}catch (exception) { | ||
console.warn(exception); | ||
} | ||
} | ||
|
||
/// Trace exception log | ||
public traceError(eventName:string, customDimension?:Record<string, string>, customMeasurement?: Record<string, number>, message?:string) { | ||
try{ | ||
oneDSLoggerWrapper.oneDSLoggerIntance.traceError(eventName, customDimension, customMeasurement, message); | ||
}catch (exception) { | ||
console.warn(exception); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.