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

update(Log): Improve logs on console #768

Merged
merged 8 commits into from
Oct 26, 2024
6 changes: 5 additions & 1 deletion src/lib/utils/Logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,12 @@ export class Logger {
console.warn(`[${level.toString()}] (${new Date().toLocaleTimeString()}): ${message}`, ...other)
break
}
case LogLevel.Info: {
console.info(`\x1b[32mℹ️ [${level.toString()}] (${new Date().toLocaleTimeString()}): ${message}\x1b[0m`, ...other)
break
}
default: {
console.log(`[${level.toString()}] (${new Date().toLocaleTimeString()}): ${message}`, ...other)
console.log(`\x1b[36mπŸ” [${level.toString()}] (${new Date().toLocaleTimeString()}): ${message}\x1b[0m`, ...other)
break
}
}
Expand Down
23 changes: 18 additions & 5 deletions src/lib/wasm/MultipassStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,10 @@ class MultipassStore {
outgoingFriendRequestsUsers
)
} catch (error) {
log.error("Error listing incoming friend requests: " + error)
let messageError: string = `${error}`
if (messageError !== "Error: MultiPass extension is unavailable") {
log.error("Error listing outgoing friend requests: " + error)
}
}
}
}
Expand Down Expand Up @@ -336,7 +339,10 @@ class MultipassStore {
get(Store.state.activeRequests).filter(r => r.direction === MessageDirection.Outbound)
)
} catch (error) {
log.error("Error listing incoming friend requests: " + error)
let messageError: string = `${error}`
if (messageError !== "Error: MultiPass extension is unavailable") {
log.error("Error listing incoming friend requests: " + error)
}
}
}
}
Expand All @@ -361,7 +367,10 @@ class MultipassStore {
}
Store.setBlockedUsers(blockedUsers)
} catch (error) {
log.error("Error listing blocked friends: " + error)
let messageError: string = `${error}`
if (messageError !== "Error: MultiPass extension is unavailable") {
log.error("Error listing blocked friends: " + error)
}
}
}
}
Expand All @@ -386,7 +395,10 @@ class MultipassStore {
}
Store.setFriends(friendsUsers)
} catch (error) {
log.error("Error listing friends: " + error)
let messageError: string = `${error}`
if (messageError !== "Error: MultiPass extension is unavailable") {
log.error("Error listing friends: " + error)
}
}
}
}
Expand Down Expand Up @@ -653,7 +665,8 @@ class MultipassStore {
}
}
}
if (lastErr) {
let lastErrStr = `${lastErr}`
if (lastErr && lastErrStr !== "Error: Identity does not exist") {
log.error(`Couldn't fetch identity ${id}: ${lastErr}`)
}
return undefined
Expand Down
Loading