Skip to content

Commit

Permalink
Improved log methods def
Browse files Browse the repository at this point in the history
- Condensed `msgType` init
+ Added empty fallback to `baseMsgStyle` init to avoid logging 'undefined' for success/error/info msg types ↞ [auto-sync from https://github.com/adamlui/ai-web-extensionss/tree/main/bravegpt]
  • Loading branch information
kudo-sync-bot committed Jan 27, 2025
1 parent 74ea734 commit e8bc932
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions chatgpt/bravegpt/bravegpt.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
// @description:zu Yengeza izimpendulo ze-AI ku-Brave Search (inikwa amandla yi-GPT-4o!)
// @author KudoAI
// @namespace https://kudoai.com
// @version 2025.1.26.18
// @version 2025.1.26.19
// @license MIT
// @icon https://assets.bravegpt.com/images/icons/bravegpt/icon48.png?v=df624b0
// @icon64 https://assets.bravegpt.com/images/icons/bravegpt/icon64.png?v=df624b0
Expand Down Expand Up @@ -442,10 +442,9 @@
const args = Array.from(arguments).map(arg => typeof arg == 'object' ? JSON.stringify(arg) : arg)
const msgType = args.some(arg => /\.{3}$/.test(arg)) ? 'working'
: args.some(arg => /\bsuccess\b|!$/i.test(arg)) ? 'success'
: args.some(arg => /\b(?:error|fail)\b/i.test(arg)) || logType == 'error' ? 'warning'
: 'info'
: args.some(arg => /\b(?:error|fail)\b/i.test(arg)) || logType == 'error' ? 'warning' : 'info'
const prefixStyle = log.styles.prefix.base + log.styles.prefix[msgType]
const baseMsgStyle = log.styles.msg[msgType], msgStyles = []
const baseMsgStyle = log.styles.msg[msgType] || '', msgStyles = []

// Combine regex
const allPatterns = Object.values(log.regEx).flatMap(val =>
Expand Down

0 comments on commit e8bc932

Please sign in to comment.