This repository contains examples of Logging with Zerolog and Logging with Zap in a simple Go web application to give you an idea of how you can get started with either package in your own projects.
Here are the accompanying tutorials:
- A Complete Guide to Logging in Go with Zerolog.
- A Comprehensive Guide to Zap Logging in Go.
- A Comprehensive Guide to Structured Logging in Go (Slog).
You must have the latest version of Go installed on your machine. This project was tested against v1.20.
- Clone this repo to your machine:
git clone https://github.com/betterstack-community/wikipedia-democdinto the project folder and switch to the relevant branch:
git checkout zerolog
git checkout zap- Run
go mod tidyto download dependencies. - Execute the command below to start the development server:
go build && ./wikipedia-demo- Visit http://localhost:3000 in your browser.
- Enter a search query, and view the corresponding logs in your console and in
the
wikipedia-demo.logfile.
The code used in this project and in the linked tutorial are licensed under the Apache License, Version 2.0.

