go-logging

command module
v0.0.0-...-9a2ec8b Latest Latest
Warning

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

Go to latest
Published: May 20, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

README ¶

Logging in Go

This repository contains examples of Logging with Zerolog, Logging with Zap, and Logging with Slog in a simple Go web application (Wikipedia Search) to give you an idea of how you can get started with logging in your own projects.

Here are the accompanying tutorials for each package:

Screenshot or GIF of the application in action

Application Logs

🟢 Prerequisites

You must have the latest version of Go installed on your machine. This project was tested against v1.20.

📦 Getting started

  • Clone this repo to your machine:
git clone https://github.com/betterstack-community/go-logging
  • cd into the project folder and switch to the relevant branch:
cd go-logging
git checkout zerolog
# or
git checkout zap
# or
git checkout slog
  • Run go mod tidy to download dependencies.
  • Execute the command below to start the development server on port 3000:
go build -o bin/logging && ./bin/logging
# or provide a different port like this
go build -o bin/logging && PORT=4000 ./bin/logging
  • Visit http://localhost:3000 in your browser.
  • Enter a search query, and view the corresponding logs in your console and in the logs/app.log file.

âš– License

The code used in this project and in the linked tutorial are licensed under the Apache License, Version 2.0.

Documentation ¶

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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