refactor(server): Replace log calls with logrus

This introduces a structured logging library that can be used (next
step) to attach additional metadata to log entries.
This commit is contained in:
Vincent Ambo 2019-10-04 22:17:11 +01:00 committed by Vincent Ambo
parent d9b329ef59
commit f4bf3518f6
8 changed files with 17 additions and 7 deletions

View file

@ -10,11 +10,11 @@ package builder
import ( import (
"archive/tar" "archive/tar"
"io" "io"
"log"
"os" "os"
"path/filepath" "path/filepath"
"github.com/google/nixery/layers" "github.com/google/nixery/layers"
log "github.com/sirupsen/logrus"
) )
// Create a new tarball from each of the paths in the list and write the tarball // Create a new tarball from each of the paths in the list and write the tarball

View file

@ -26,7 +26,6 @@ import (
"fmt" "fmt"
"io" "io"
"io/ioutil" "io/ioutil"
"log"
"net/http" "net/http"
"net/url" "net/url"
"os" "os"
@ -38,6 +37,7 @@ import (
"github.com/google/nixery/config" "github.com/google/nixery/config"
"github.com/google/nixery/layers" "github.com/google/nixery/layers"
"github.com/google/nixery/manifest" "github.com/google/nixery/manifest"
log "github.com/sirupsen/logrus"
"golang.org/x/oauth2/google" "golang.org/x/oauth2/google"
) )

View file

@ -19,11 +19,11 @@ import (
"encoding/json" "encoding/json"
"io" "io"
"io/ioutil" "io/ioutil"
"log"
"os" "os"
"sync" "sync"
"github.com/google/nixery/manifest" "github.com/google/nixery/manifest"
log "github.com/sirupsen/logrus"
) )
// LocalCache implements the structure used for local caching of // LocalCache implements the structure used for local caching of

View file

@ -19,10 +19,10 @@ package config
import ( import (
"io/ioutil" "io/ioutil"
"log"
"os" "os"
"cloud.google.com/go/storage" "cloud.google.com/go/storage"
log "github.com/sirupsen/logrus"
) )
// Load (optional) GCS bucket signing data from the GCS_SIGNING_KEY and // Load (optional) GCS bucket signing data from the GCS_SIGNING_KEY and

View file

@ -17,10 +17,11 @@ import (
"crypto/sha1" "crypto/sha1"
"encoding/json" "encoding/json"
"fmt" "fmt"
"log"
"os" "os"
"regexp" "regexp"
"strings" "strings"
log "github.com/sirupsen/logrus"
) )
// PkgSource represents the source from which the Nix package set used // PkgSource represents the source from which the Nix package set used

View file

@ -117,4 +117,13 @@
sha256 = "1b7q6haabnp53igpmvr6a2414yralhbrldixx4kbxxg1apy8jdjg"; sha256 = "1b7q6haabnp53igpmvr6a2414yralhbrldixx4kbxxg1apy8jdjg";
}; };
} }
{
goPackagePath = "github.com/sirupsen/logrus";
fetch = {
type = "git";
url = "https://github.com/sirupsen/logrus";
rev = "de736cf91b921d56253b4010270681d33fdf7cb5";
sha256 = "1qixss8m5xy7pzbf0qz2k3shjw0asklm9sj6zyczp7mryrari0aj";
};
}
] ]

View file

@ -105,11 +105,11 @@ package layers
import ( import (
"crypto/sha1" "crypto/sha1"
"fmt" "fmt"
"log"
"regexp" "regexp"
"sort" "sort"
"strings" "strings"
log "github.com/sirupsen/logrus"
"gonum.org/v1/gonum/graph/flow" "gonum.org/v1/gonum/graph/flow"
"gonum.org/v1/gonum/graph/simple" "gonum.org/v1/gonum/graph/simple"
) )

View file

@ -30,7 +30,6 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"log"
"net/http" "net/http"
"regexp" "regexp"
"time" "time"
@ -39,6 +38,7 @@ import (
"github.com/google/nixery/builder" "github.com/google/nixery/builder"
"github.com/google/nixery/config" "github.com/google/nixery/config"
"github.com/google/nixery/layers" "github.com/google/nixery/layers"
log "github.com/sirupsen/logrus"
) )
// ManifestMediaType is the Content-Type used for the manifest itself. This // ManifestMediaType is the Content-Type used for the manifest itself. This