zapvk

package
v3.0.0-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Log

func Log(l *zap.Logger, lvl zapcore.Level, skipResponse bool) func(handler sdkutil.Handler) sdkutil.Handler

Log is middleware which logs VK API request info.

Example
package main

import (
	"fmt"

	"github.com/SevereCloud/vksdk/v2/api"
	sdkutil "github.com/tdakkota/vksdkutil/v3"
	"github.com/tdakkota/vksdkutil/v3/middleware/zapvk"
	"go.uber.org/zap"
	"go.uber.org/zap/zapcore"
)

func main() {
	vk := sdkutil.BuildSDK("token").WithMiddleware(
		zapvk.Log(zap.L(), zapcore.DebugLevel, true),
	).Complete()

	users, err := vk.UsersGet(api.Params{})
	if err != nil {
		panic(err)
	}
	fmt.Println(users)
}
Output:

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL