streetlogr

package module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

README

StreetLogr

StreetLogr is a slick, urban-themed logging interface built around Go's logr interface.

🚀 Features

  • 🗣️ Word: Drop informational messages in style.
  • 👀 Sus: Log errors when things look suspicious.
  • 🔍 Peep: Adjust verbosity levels to peep more details.
  • 🌟 Swag: Add some swag to your logs with key-value pairs.
  • 🏷️ Handle: Tag your logger with a unique name.

🛠 Installation

Install StreetLogr using go get:

go get github.com/afritzler/streetlogr

Usage

Here's a quick start guide to using StreetLogr:

package main

import (
	"errors"
	"github.com/go-logr/zapr"
	"go.uber.org/zap"
	"github.com/afritzler/streetlogr"
)

func main() {
	// Instantiate a zap logger
	zapLogger, _ := zap.NewDevelopment()

	// Wrap it with zapr to get a logr.Logger
	logrLogger := zapr.NewLogger(zapLogger)

	// Instantiate StreetLogr
	logger := streetlogr.StreetLogr{logrLogger}

	// Use the logger
	logger.Word("The buzz in the street", "key1", "value1")

	err := errors.New("some creepy error")
	logger.Sus(err, "It's looking sus!", "key1", "value1")
}

A more extensible example can be found in the example folder.

🤝 Contributing

Contributions are what make the open-source community an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📄 License

Distributed under the Apache 2.0 License. See LICENSE.md for more information.

📣 Acknowledgements

  • Go logr
  • Uber's zap
  • The incredible Go community

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StreetLogr

type StreetLogr struct {
	logr.Logger
}

StreetLogr is a struct that embeds the logr.Logger interface and renames the methods with street slang for a cooler vibe.

func (StreetLogr) Handle

func (l StreetLogr) Handle(name string) StreetLogr

Handle adds a new name element to the logger. In street slang, "handle" often refers to a nickname or alias.

func (StreetLogr) Peep

func (l StreetLogr) Peep(level int) StreetLogr

Peep returns a new logger with the specified verbosity level. "Peep" is slang for taking a quick look at something.

func (StreetLogr) Sus

func (l StreetLogr) Sus(err error, msg string, keysAndValues ...interface{})

Sus logs error messages. "Sus" is slang for suspicious or something not right.

func (StreetLogr) Swag

func (l StreetLogr) Swag(keysAndValues ...interface{}) StreetLogr

Swag adds key-value pairs to the logger's context. "Swag" is a popular street term referring to a cool, confident style.

func (StreetLogr) Word

func (l StreetLogr) Word(msg string, keysAndValues ...interface{})

Word logs informational messages. It's like the "word on the street."

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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