Skip to content
/ horus Public
forked from ichtrojan/horus

HTTP request logger for Golang

License

Notifications You must be signed in to change notification settings

iCodeIN/horus

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Horus 𓂀

horus-hero

Introduction

Horus is a request logger and viewer for Go. It allows developers log and view http requests made to their web application.

horus-big-brother

Installation

Run the following command to install Horus on your project:

go get github.com/ichtrojan/horus

Initiate horus

package main

import github.com/ichtrojan/horus

func main() {
    listener, err := horus.Init("mysql", horus.Config{
		DbName:    "{preferred_database_name}",
		DbHost:    "{preferred_database_host}",
		DbPssword: "{preferred_database_password}",
		DbPort:    "{preferred_database_port}",
		DbUser:    "{preferred_database_user}",
	})
}

NOTE
Supported database adapters include mysql and postgres

Serve dashboard (optional)

horus-message-received

...
if err = listener.Serve(":{preferred_port}", "{preferred_password}"); err != nil {
	log.Fatal(err)
}
...

Usage

To enable horus to listen for requests, use the Watch middleware provided by horus on the endpoints you will like monitor.

...
http.HandleFunc("/", listener.Watch(func(w http.ResponseWriter, r *http.Request) {
    w.Header().Set("Content-Type", "application/json")

    response := map[string]string{"message": "Horus is live 👁"}

    _ = json.NewEncoder(w).Encode(response)
}))
...

You can explore the implementation in the example folder.

Built by

About

HTTP request logger for Golang

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 89.5%
  • JavaScript 9.7%
  • Shell 0.8%