Refactor custom events
This commit is contained in:
1 parent
c9a0e96905
commit
47a7ea21e6
6 files changed
+14
-11
No files matched your search
@@ -118,11 +118,11 @@ function OnLineSysLog(event as object, dateTime as object, logsFile as string, b
|
|||||||
' They're usually repetitive, one is reported for each stream in a DASH
|
' They're usually repetitive, one is reported for each stream in a DASH
|
||||||
' when a video is blocked
|
' when a video is blocked
|
||||||
if m.sysLogEventDropCounter = 0
|
if m.sysLogEventDropCounter = 0
|
||||||
m.global.telemetry.LogEvent = {
|
LogTelemetryEvent({
|
||||||
level: "error"
|
level: "error"
|
||||||
message: line
|
message: line
|
||||||
fingerprint: ["SysLog", info.Status, info.LogType, info.HttpCode, info.Method]
|
fingerprint: ["SysLog", info.Status, info.LogType, info.HttpCode, info.Method]
|
||||||
}
|
})
|
||||||
end if
|
end if
|
||||||
m.sysLogEventDropCounter = (m.sysLogEventDropCounter + 1) mod 10
|
m.sysLogEventDropCounter = (m.sysLogEventDropCounter + 1) mod 10
|
||||||
end function
|
end function
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ namespace InnertubeService
|
|||||||
return GetVideoMetadata(videoId, options)
|
return GetVideoMetadata(videoId, options)
|
||||||
end if
|
end if
|
||||||
if code = "MISSING_FORMAT_FIELD"
|
if code = "MISSING_FORMAT_FIELD"
|
||||||
m.global.telemetry.LogEvent = {
|
LogTelemetryEvent({
|
||||||
level: "error"
|
level: "error"
|
||||||
message: code
|
message: code
|
||||||
fingerprint: code
|
fingerprint: code
|
||||||
@@ -125,7 +125,7 @@ namespace InnertubeService
|
|||||||
content_type: "application/json"
|
content_type: "application/json"
|
||||||
data: playerResponse.Text()
|
data: playerResponse.Text()
|
||||||
}]
|
}]
|
||||||
}
|
})
|
||||||
end if
|
end if
|
||||||
throw exception
|
throw exception
|
||||||
end try
|
end try
|
||||||
|
|||||||
@@ -1745,8 +1745,7 @@ namespace Innertube
|
|||||||
nodeDataString = FormatJson(nodeData)
|
nodeDataString = FormatJson(nodeData)
|
||||||
|
|
||||||
LogWarnNoTelemetry(message + `\n` + nodeDataString)
|
LogWarnNoTelemetry(message + `\n` + nodeDataString)
|
||||||
|
LogTelemetryEvent ({
|
||||||
m.global.telemetry.LogEvent = {
|
|
||||||
level: "warning"
|
level: "warning"
|
||||||
message: message
|
message: message
|
||||||
fingerprint: message
|
fingerprint: message
|
||||||
@@ -1759,6 +1758,6 @@ namespace Innertube
|
|||||||
content_type: "text/plain"
|
content_type: "text/plain"
|
||||||
data: context.response.request.ToCurlCommand()
|
data: context.response.request.ToCurlCommand()
|
||||||
}]
|
}]
|
||||||
}
|
})
|
||||||
end function
|
end function
|
||||||
end namespace
|
end namespace
|
||||||
@@ -571,12 +571,12 @@ function ReportVideoError(errorData as object, url as string) as void
|
|||||||
end if
|
end if
|
||||||
end if
|
end if
|
||||||
|
|
||||||
m.global.telemetry.LogEvent = {
|
LogTelemetryEvent({
|
||||||
level: "error"
|
level: "error"
|
||||||
message: errorData.title + " " + errorData.body + `\n url: ${url}`
|
message: errorData.title + " " + errorData.body + `\n url: ${url}`
|
||||||
fingerprint: errorData.fingerprint
|
fingerprint: errorData.fingerprint
|
||||||
attachments: attachments
|
attachments: attachments
|
||||||
}
|
})
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnVideoFinished() as void
|
function OnVideoFinished() as void
|
||||||
|
|||||||
@@ -100,11 +100,11 @@ namespace Http
|
|||||||
|
|
||||||
if operation = invalid or operation = ""
|
if operation = invalid or operation = ""
|
||||||
LogErrorNoTelemetry("empty request")
|
LogErrorNoTelemetry("empty request")
|
||||||
m.global.telemetry.LogEvent = {
|
LogTelemetryEvent({
|
||||||
level: "error"
|
level: "error"
|
||||||
message: "empty request: " + FormatJson({ "m.buffer": m.buffer, "m.buffer_index": m.buffer_index })
|
message: "empty request: " + FormatJson({ "m.buffer": m.buffer, "m.buffer_index": m.buffer_index })
|
||||||
fingerprint: ["HttpRequest: empty request"]
|
fingerprint: ["HttpRequest: empty request"]
|
||||||
}
|
})
|
||||||
m.ready_for_response = true
|
m.ready_for_response = true
|
||||||
return false
|
return false
|
||||||
end if
|
end if
|
||||||
|
|||||||
@@ -29,6 +29,10 @@ function LogDebug(_arg1 = invalid as dynamic, _arg2 = invalid as dynamic, _arg3
|
|||||||
throw "FATAL: Calling LogDebug() which is a stub function"
|
throw "FATAL: Calling LogDebug() which is a stub function"
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
function LogTelemetryEvent(event as object)
|
||||||
|
m.global.telemetry.LogEvent = event
|
||||||
|
end function
|
||||||
|
|
||||||
function ToString(value as dynamic) as string
|
function ToString(value as dynamic) as string
|
||||||
if getInterface(value, "ifString") <> invalid
|
if getInterface(value, "ifString") <> invalid
|
||||||
return value
|
return value
|
||||||
|
|||||||
Reference in new issue
Block a user