-
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.
* public keys fix * LogFast has been added as a Fast custom logging function
- Loading branch information
Showing
2 changed files
with
28 additions
and
17 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package logger | ||
|
||
import ( | ||
"github.com/gateway-fm/scriptorium/fast_helper" | ||
"github.com/gateway-fm/scriptorium/helper" | ||
"github.com/valyala/fasthttp" | ||
"go.uber.org/zap" | ||
) | ||
|
||
// LogWithFastContext is invoking Zap Logger function with fasthttp context | ||
func LogWithFastContext(ctx *fasthttp.RequestCtx) *Zaplog { | ||
initLogger() | ||
|
||
publicKey := fast_helper.GetPublicKey(ctx) | ||
if publicKey == "" { | ||
publicKey = helper.PublicKeyNotSet | ||
} | ||
|
||
return instance.With( | ||
zap.String(string(helper.ContextKeyRequestID), fast_helper.GetRequestID(ctx)), | ||
zap.String(string(helper.PublicKey), publicKey), | ||
) | ||
} | ||
|
||
func LogFast(ctx *fasthttp.RequestCtx) *Zaplog { | ||
initLogger() | ||
return instance | ||
} |
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