FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
client-sdk-react-native/example/src/utils/ErrorLogHandler.ts at main · livekit/client-sdk-react-native · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
livekit
/
client-sdk-react-native
Public
Notifications
You must be signed in to change notification settings
Fork
67
Star
287
Code
Issues
20
Pull requests
19
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
client-sdk-react-native
/
example
/
src
/
utils
/
ErrorLogHandler.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
50 lines (43 loc) · 1.39 KB
Breadcrumbs
client-sdk-react-native
/
example
/
src
/
utils
/
ErrorLogHandler.ts
Copy path
File metadata and controls
50 lines (43 loc) · 1.39 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//
@ts
-ignore
import
{
observe
as
observeLogBoxLogs
,
symbolicateLogNow
,
}
from
'react-native/Libraries/LogBox/Data/LogBoxData'
;
// Log errors
export
function
setupErrorLogHandler
(
)
{
// LogBox keeps all logs that you have not viewed yet.
// When a new log comes in, we only want to print out the new ones.
let
lastCount
=
0
;
//
@ts
-ignore
observeLogBoxLogs
(
(
data
)
=>
{
const
logs
=
Array
.
from
(
data
.
logs
)
;
//
@ts
-ignore
const
symbolicatedLogs
=
logs
.
filter
(
(
log
)
=>
log
.
symbolicated
.
stack
?.
length
)
;
for
(
let
i
=
lastCount
;
i
<
symbolicatedLogs
.
length
;
i
++
)
{
// use log instead of warn/error to prevent resending error to LogBox
console
.
log
(
formatLog
(
symbolicatedLogs
[
i
]
)
)
;
}
lastCount
=
symbolicatedLogs
.
length
;
// Trigger symbolication on remaining logs because
// logs do not symbolicate until you click on LogBox
//
@ts
-ignore
logs
.
filter
(
(
log
)
=>
log
.
symbolicated
.
status
===
'NONE'
)
.
forEach
(
(
log
)
=>
symbolicateLogNow
(
log
)
)
;
}
)
;
}
//
@ts
-ignore
function
formatLog
(
log
)
{
const
stackLines
=
(
log
.
symbolicated
.
stack
||
[
]
)
//
@ts
-ignore
.
filter
(
(
line
)
=>
!
line
.
collapse
)
//
@ts
-ignore
.
map
(
(
line
)
=>
` at
${
line
.
methodName
}
(
${
line
.
file
}
:
${
line
.
lineNumber
}
:
${
line
.
column
}
)`
)
.
join
(
'\n'
)
;
return
`Error has been symbolicated\nError:
${
log
.
message
.
content
}
\n
${
stackLines
}
`
;
}
Back
|
FazBrowse Home
|
New Git URL