GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - ansu/multilogger

BranchesTags
Open more actions menu

Latest commit

 

History

6 Commits
6 Commits

Folders and files

NameName
Last commit message
Last commit date
logger
logger
 
 
README.md
README.md
 
 
go.mod
go.mod
 
 
go.sum
go.sum
 
 
main.go
main.go
 
 

Repository files navigation

Multi Logger

Multi logger is a Go package that provides a wrapper for both logrus and zap loggers, allowing you to easily switch between the two logging frameworks in your application.

Installation

To use Dual Logger in your Go project, you can install it using go get:

go get github.com/ansu/multilogger

Usage

To use Dual Logger in your code, you first need to create an instance of the logger wrapper:

import (
 
  "github.com/ansu/multilogger"
)

// Create a new logrus logger
loggerWrapper := logger.NewLoggerWrapper("logrus", ctx)
//or 
loggerWrapper = logger.NewLoggerWrapper("zap", ctx)

Once you have created the logger wrapper, you can use it to log messages. Here's an example of how to log a message with fields using the logger wrapper:

//With Common fields similar to logrus.WithFields
commonFields := map[string]interface{}{
		"userId":    "12345",
		"ipAddress": "192.168.0.1",
	}
	ctx := context.WithValue(context.Background(), "commonFields", commonFields)
  loggerWrapper.Info("This is an info log message.", commonFields)
//In the above example, the ctx variable is a context.Context instance that contains any additional contextual information you want to include in the log //message.

License

Dual Logger is released under the MIT License. See LICENSE for details.

About

No description, website, or topics provided.

Resources

Readme
Activity

Stars

4 stars

Watchers

1 watching

Forks

1 fork
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.