zap

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2020 License: MIT Imports: 5 Imported by: 14

README

Logur adapter for Uber's Zap

GitHub Workflow Status Codecov Go Report Card Go Version go.dev reference

Installation

go get logur.dev/adapter/zap

Usage

package main

import (
	"go.uber.org/zap"
	zapadapter "logur.dev/adapter/zap"
)

func main() {
	logger := zapadapter.New(zap.NewNop())
}

Development

When all coding and testing is done, please run the test suite:

$ make check

License

The MIT License (MIT). Please see License File for more information.

Documentation

Overview

Package zap provides a Logur adapter for Uber's Zap.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger is a Logur adapter for Uber's Zap.

func New

func New(logger *zap.Logger) *Logger

New returns a new Logur logger. If logger is nil, a default instance is created.

Example
package main

import (
	"go.uber.org/zap"

	zapadapter "logur.dev/adapter/zap"
)

func main() {
	logger := zapadapter.New(zap.NewNop())

	_ = logger
}
Output:

Example (Default)

If logger is nil, a default instance is created.

package main

import (
	zapadapter "logur.dev/adapter/zap"
)

func main() {
	logger := zapadapter.New(nil)

	_ = logger
}
Output:

func (*Logger) Debug

func (l *Logger) Debug(msg string, fields ...map[string]interface{})

Debug implements the Logur Logger interface.

func (*Logger) DebugContext added in v0.4.0

func (l *Logger) DebugContext(_ context.Context, msg string, fields ...map[string]interface{})

func (*Logger) Error

func (l *Logger) Error(msg string, fields ...map[string]interface{})

Error implements the Logur Logger interface.

func (*Logger) ErrorContext added in v0.4.0

func (l *Logger) ErrorContext(_ context.Context, msg string, fields ...map[string]interface{})

func (*Logger) Info

func (l *Logger) Info(msg string, fields ...map[string]interface{})

Info implements the Logur Logger interface.

func (*Logger) InfoContext added in v0.4.0

func (l *Logger) InfoContext(_ context.Context, msg string, fields ...map[string]interface{})

func (*Logger) LevelEnabled

func (l *Logger) LevelEnabled(level logur.Level) bool

LevelEnabled implements the Logur LevelEnabler interface.

func (*Logger) Trace

func (l *Logger) Trace(msg string, fields ...map[string]interface{})

Trace implements the Logur Logger interface.

func (*Logger) TraceContext added in v0.4.0

func (l *Logger) TraceContext(_ context.Context, msg string, fields ...map[string]interface{})

func (*Logger) Warn

func (l *Logger) Warn(msg string, fields ...map[string]interface{})

Warn implements the Logur Logger interface.

func (*Logger) WarnContext added in v0.4.0

func (l *Logger) WarnContext(_ context.Context, msg string, fields ...map[string]interface{})

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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