Switch from logrus to zerolog, move types into types.go

This commit is contained in:
2023-12-24 15:47:11 -06:00
parent 40330c37ce
commit 4dce1de842
7 changed files with 95 additions and 96 deletions

View File

@@ -4,12 +4,12 @@ import (
"net/http/cookiejar"
"net/url"
log "github.com/sirupsen/logrus"
log "github.com/rs/zerolog/log"
)
func setup(cookies *cookiejar.Jar) {
// Makes the initial requests that sets up the session cookies for the rest of the application
log.Println("Setting up session...")
log.Info().Msg("Setting up session...")
request_queue := []string{
"/registration/registration",
@@ -26,7 +26,7 @@ func setup(cookies *cookiejar.Jar) {
// Validate that cookies were set
baseURL_parsed, err := url.Parse(baseURL)
if err != nil {
log.Fatalf("Failed to parse baseURL: %s", baseURL)
log.Fatal().Msgf("Failed to parse baseURL: %s", baseURL)
}
current_cookies := cookies.Cookies(baseURL_parsed)
@@ -46,10 +46,10 @@ func setup(cookies *cookiejar.Jar) {
// Check if all required cookies were set
for cookie_name, cookie_set := range required_cookies {
if !cookie_set {
log.Fatalf("Required cookie %s was not set", cookie_name)
log.Error().Msgf("Required cookie %s was not set", cookie_name)
}
}
log.Println("All cookies acquired. Session setup complete.")
log.Info().Msg("All cookies acquired. Session setup complete.")
// TODO: Validate that the session allows access to termSelection
}