Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitaa86304

Browse files
committed
clean up logs
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parentb63c31b commitaa86304

File tree

5 files changed

+25
-13
lines changed

5 files changed

+25
-13
lines changed

‎src/channel/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ class Channel implements Channel {
329329
case'TEST_PASS':
330330
consttutorial=this.context.tutorial.get()
331331
if(!tutorial){
332-
thrownewError('Error with current tutorial')
332+
thrownewError('ERROR: Tutorial not found in test run')
333333
}
334334
// update local storage stepProgress
335335
constprogress=this.context.progress.setStepComplete(tutorial,action.payload.stepId)
@@ -340,7 +340,7 @@ class Channel implements Channel {
340340
// send message
341341
constsentToClient=awaitthis.postMessage(action)
342342
if(!sentToClient){
343-
thrownewError(`Message post failure:${JSON.stringify(action)}`)
343+
thrownewError(`ERROR:Message post failure:${JSON.stringify(action)}`)
344344
}
345345
}
346346
}

‎src/services/logger/index.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
import{LOG}from'../../environment'
22

3-
constlogger=(message:string|string[])=>{
3+
exporttypeLog=string|object
4+
5+
constlogger=(...messages:Log[]):void=>{
46
if(!LOG){
57
return
68
}
7-
if(Array.isArray(message)){
8-
message.forEach(console.log)
9-
}else{
10-
console.log(message)
9+
// Inside vscode, you console.log does not allow more than 1 param
10+
// to get around it, we can log with multiple log statements
11+
for(constmessageofmessages){
12+
if(typeofmessage==='object'){
13+
console.log(JSON.stringify(message))
14+
}else{
15+
console.log(message)
16+
}
1117
}
1218
}
1319

‎web-app/src/components/ErrorBoundary/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ class ErrorBoundary extends React.Component {
1010
// Display fallback UI
1111
this.setState({errorMessage:error.message})
1212
// You can also log the error to an error reporting service
13-
logger('ERROR in component:',JSON.stringify(error))
14-
logger('ERROR info:',JSON.stringify(info))
13+
logger('ERROR in component:',error)
14+
logger('ERROR info:',info)
1515
}
1616

1717
publicrender(){

‎web-app/src/components/Router/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ const useRouter = (): Output => {
5959
}elseif(Array.isArray(path)){
6060
pathMatch=path.some((p)=>state.matches(p))
6161
}else{
62-
thrownewError(`Invalid route path${JSON.stringify(path)}`)
62+
thrownewError(`ERROR:Invalid route path:${JSON.stringify(path)}`)
6363
}
6464
if(pathMatch){
6565
//@ts-ignore
6666
returnchild.props.children
6767
}
6868
}
69-
constmessage=`No Route matches for${JSON.stringify(state)}`
69+
constmessage=`ERROR:No Route matches for${JSON.stringify(state)}`
7070
onError(newError(message))
7171
console.warn(message)
7272
returnnull

‎web-app/src/services/logger/index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
import{LOG}from'../../environment'
22

3-
constlogger=(...messages:string[])=>{
3+
exporttypeLog=string|object
4+
5+
constlogger=(...messages:Log[]):void=>{
46
if(!LOG){
57
return
68
}
79
// Inside vscode, you console.log does not allow more than 1 param
810
// to get around it, we can log with multiple log statements
911
for(constmessageofmessages){
10-
console.log(message)
12+
if(typeofmessage==='object'){
13+
console.log(JSON.stringify(message))
14+
}else{
15+
console.log(message)
16+
}
1117
}
1218
}
1319

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp