-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Feat [Language] Constant - [+] feat(init_const.go): add constant for unsupported log level message * Refactor [Navigator] Logger - [+] feat(navigator): add rate limiter for log output - [+] fix(navigator): change log level for error messages to info level
- Loading branch information
1 parent
b3964fc
commit 96cb1aa
Showing
3 changed files
with
63 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,3 +87,7 @@ const ( | |
const ( | ||
PirateEmoji = "🏴☠️ " | ||
) | ||
|
||
const ( | ||
Unsupportedloglevel = "unsupported log level: %v\n" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package navigator | ||
|
||
import ( | ||
"time" | ||
|
||
"golang.org/x/time/rate" | ||
) | ||
|
||
// logLimiter controls the rate of log output. | ||
var logLimiter *rate.Limiter | ||
|
||
// Initialize the rate limiter with a limit of 1 event per second and a burst size of 5. | ||
func init() { | ||
logLimiter = rate.NewLimiter(rate.Every(time.Second), 5) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters