Skip to content

Commit

Permalink
use nanolib for logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jessepeterson committed Jun 13, 2024
1 parent a68fd2c commit 63df3a6
Show file tree
Hide file tree
Showing 19 changed files with 42 additions and 257 deletions.
7 changes: 4 additions & 3 deletions cmd/kmfddm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ import (
"os"
"time"

"github.com/alexedwards/flow"
httpddm "github.com/jessepeterson/kmfddm/http"
apihttp "github.com/jessepeterson/kmfddm/http/api"
ddmhttp "github.com/jessepeterson/kmfddm/http/ddm"
"github.com/jessepeterson/kmfddm/log/logkeys"
"github.com/jessepeterson/kmfddm/log/stdlogfmt"
"github.com/jessepeterson/kmfddm/logkeys"
"github.com/jessepeterson/kmfddm/notifier"
"github.com/jessepeterson/kmfddm/notifier/foss"

"github.com/alexedwards/flow"
"github.com/micromdm/nanolib/log/stdlogfmt"
)

// overridden by -ldflags -X
Expand Down
6 changes: 3 additions & 3 deletions cmd/kmfddm/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import (
"strconv"
"strings"

"github.com/cespare/xxhash"
"github.com/jessepeterson/kmfddm/log"
"github.com/jessepeterson/kmfddm/log/logkeys"
"github.com/jessepeterson/kmfddm/logkeys"
"github.com/jessepeterson/kmfddm/storage"
"github.com/jessepeterson/kmfddm/storage/file"
"github.com/jessepeterson/kmfddm/storage/mysql"

"github.com/cespare/xxhash"
_ "github.com/go-sql-driver/mysql"
"github.com/micromdm/nanolib/log"
)

type allStorage interface {
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
module github.com/jessepeterson/kmfddm

go 1.17
go 1.21.3

require (
github.com/alexedwards/flow v0.0.0-20220806114457-cf11be9e0e03
github.com/cespare/xxhash v1.1.0
github.com/go-sql-driver/mysql v1.8.1
github.com/google/uuid v1.6.0
github.com/groob/plist v0.0.0-20220217120414-63fa881b19a5
github.com/micromdm/nanolib v0.1.0
github.com/valyala/fastjson v1.6.4
)

Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/groob/plist v0.0.0-20220217120414-63fa881b19a5 h1:saaSiB25B1wgaxrshQhurfPKUGJ4It3OxNJUy0rdOjU=
github.com/groob/plist v0.0.0-20220217120414-63fa881b19a5/go.mod h1:itkABA+w2cw7x5nYUS/pLRef6ludkZKOigbROmCTaFw=
github.com/micromdm/nanolib v0.1.0 h1:L2Ws5xrYHZDKFS+LQqLGCzHZHyAIXYkQ+1QmgRX6l/o=
github.com/micromdm/nanolib v0.1.0/go.mod h1:FwBKCvvphgYvbdUZ+qw5kay7NHJcg6zPi8W7kXNajmE=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72 h1:qLC7fQah7D6K1B0ujays3HV9gkFtllcxhzImRR7ArPQ=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/valyala/fastjson v1.6.4 h1:uAUNq9Z6ymTgGhcm0UynUAB6tlbakBrz6CQFax3BXVQ=
Expand Down
7 changes: 4 additions & 3 deletions http/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ import (
"net/url"
"strings"

"github.com/jessepeterson/kmfddm/logkeys"

"github.com/alexedwards/flow"
"github.com/jessepeterson/kmfddm/log"
"github.com/jessepeterson/kmfddm/log/ctxlog"
"github.com/jessepeterson/kmfddm/log/logkeys"
"github.com/micromdm/nanolib/log"
"github.com/micromdm/nanolib/log/ctxlog"
)

type Notifier interface {
Expand Down
7 changes: 4 additions & 3 deletions http/api/declarations.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import (
"net/http"

"github.com/jessepeterson/kmfddm/ddm"
"github.com/jessepeterson/kmfddm/log"
"github.com/jessepeterson/kmfddm/log/ctxlog"
"github.com/jessepeterson/kmfddm/log/logkeys"
"github.com/jessepeterson/kmfddm/logkeys"
"github.com/jessepeterson/kmfddm/storage"

"github.com/micromdm/nanolib/log"
"github.com/micromdm/nanolib/log/ctxlog"
)

// PutDeclarationHandler returns a handler that stores a declaration.
Expand Down
3 changes: 2 additions & 1 deletion http/api/enrollments.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (
"net/http"
"net/url"

"github.com/jessepeterson/kmfddm/log"
"github.com/jessepeterson/kmfddm/storage"

"github.com/micromdm/nanolib/log"
)

// GetEnrollmentSetsHandler returns a handle that retrieves the list of sets for an enrollment ID.
Expand Down
2 changes: 1 addition & 1 deletion http/api/notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package api
import (
"net/http"

"github.com/jessepeterson/kmfddm/log"
"github.com/micromdm/nanolib/log"
)

// NotifyHandler notifies enrollment IDs.
Expand Down
5 changes: 3 additions & 2 deletions http/api/sets.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import (
"net/http"
"net/url"

"github.com/jessepeterson/kmfddm/log"
"github.com/jessepeterson/kmfddm/log/ctxlog"
"github.com/jessepeterson/kmfddm/storage"

"github.com/micromdm/nanolib/log"
"github.com/micromdm/nanolib/log/ctxlog"
)

// GetDeclarationSetsHandler retrieves the list of sets for an declaration ID.
Expand Down
5 changes: 3 additions & 2 deletions http/api/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import (
"strconv"
"strings"

"github.com/jessepeterson/kmfddm/log"
"github.com/jessepeterson/kmfddm/log/ctxlog"
"github.com/jessepeterson/kmfddm/storage"

"github.com/micromdm/nanolib/log"
"github.com/micromdm/nanolib/log/ctxlog"
)

// GetDeclarationStatusHandler returns a handler that retrives that last declaration status for an enrollment ID.
Expand Down
7 changes: 4 additions & 3 deletions http/ddm/ddm.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ import (

"github.com/jessepeterson/kmfddm/ddm"
httpddm "github.com/jessepeterson/kmfddm/http"
"github.com/jessepeterson/kmfddm/log"
"github.com/jessepeterson/kmfddm/log/ctxlog"
"github.com/jessepeterson/kmfddm/log/logkeys"
"github.com/jessepeterson/kmfddm/logkeys"
"github.com/jessepeterson/kmfddm/storage"

"github.com/micromdm/nanolib/log"
"github.com/micromdm/nanolib/log/ctxlog"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"net"
"net/http"

"github.com/jessepeterson/kmfddm/log"
"github.com/jessepeterson/kmfddm/log/ctxlog"
"github.com/micromdm/nanolib/log"
"github.com/micromdm/nanolib/log/ctxlog"
)

// ReadAllAndReplaceBody reads all of r.Body and replaces it with a new byte buffer.
Expand Down
72 changes: 0 additions & 72 deletions log/ctxlog/ctxlog.go

This file was deleted.

17 changes: 0 additions & 17 deletions log/logger.go

This file was deleted.

21 changes: 0 additions & 21 deletions log/nop.go

This file was deleted.

116 changes: 0 additions & 116 deletions log/stdlogfmt/stdlog.go

This file was deleted.

File renamed without changes.
Loading

0 comments on commit 63df3a6

Please sign in to comment.