Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch to NanoLIB log #67

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions cmd/depserver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ import (
"github.com/micromdm/nanodep/client"
dephttp "github.com/micromdm/nanodep/http"
"github.com/micromdm/nanodep/http/api"
"github.com/micromdm/nanodep/log/stdlogfmt"
"github.com/micromdm/nanodep/proxy"

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

// overridden by -ldflags -X
Expand Down Expand Up @@ -53,7 +54,10 @@ func main() {
os.Exit(1)
}

logger := stdlogfmt.New(stdlog.Default(), *flDebug)
logger := stdlogfmt.New(
stdlogfmt.WithLogger(stdlog.Default()),
stdlogfmt.WithDebugFlag(*flDebug),
)

storage, err := cli.Storage(*flStorage, *flDSN)
if err != nil {
Expand Down
8 changes: 6 additions & 2 deletions cmd/depsyncer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ import (

"github.com/micromdm/nanodep/cli"
"github.com/micromdm/nanodep/godep"
"github.com/micromdm/nanodep/log/stdlogfmt"
depsync "github.com/micromdm/nanodep/sync"

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

// overridden by -ldflags -X
Expand Down Expand Up @@ -52,7 +53,10 @@ func main() {
os.Exit(1)
}

logger := stdlogfmt.New(stdlog.Default(), *flDebug)
logger := stdlogfmt.New(
stdlogfmt.WithLogger(stdlog.Default()),
stdlogfmt.WithDebugFlag(*flDebug),
)

storage, err := cli.Storage(*flStorage, *flDSN)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.17
require (
github.com/go-sql-driver/mysql v1.8.1
github.com/gomodule/oauth1 v0.2.0
github.com/micromdm/nanolib v0.1.1
github.com/smallstep/pkcs7 v0.0.0-20231107075624-be1870d87d13
)

Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@ github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpv
github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
github.com/gomodule/oauth1 v0.2.0 h1:/nNHAD99yipOEspQFbAnNmwGTZ1UNXiD/+JLxwx79fo=
github.com/gomodule/oauth1 v0.2.0/go.mod h1:4r/a8/3RkhMBxJQWL5qzbOEcaQmNPIkNoI7P8sXeI08=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/micromdm/nanolib v0.1.1 h1:nNwY2xLBTHSpwEJsW5xGjkW9MdskAbeo/e6+ZYwr2mE=
github.com/micromdm/nanolib v0.1.1/go.mod h1:FwBKCvvphgYvbdUZ+qw5kay7NHJcg6zPi8W7kXNajmE=
github.com/peterbourgon/diskv/v3 v3.0.1/go.mod h1:kJ5Ny7vLdARGU3WUuy6uzO6T0nb/2gWcT1JiBvRmb5o=
github.com/smallstep/pkcs7 v0.0.0-20231107075624-be1870d87d13 h1:qRxEt9ESQhAg1kjmgJ8oyyzlc9zkAjOooe7bcKjKORQ=
github.com/smallstep/pkcs7 v0.0.0-20231107075624-be1870d87d13/go.mod h1:SoUAr/4M46rZ3WaLstHxGhLEgoYIDRqxQEXLOmOEB0Y=
5 changes: 3 additions & 2 deletions http/api/assigner.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import (
"encoding/json"
"net/http"

"github.com/micromdm/nanodep/log"
"github.com/micromdm/nanodep/log/ctxlog"
"github.com/micromdm/nanodep/sync"

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

// RetrieveAssignerProfileHandler returns the assigner profile UUID for the
Expand Down
5 changes: 3 additions & 2 deletions http/api/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (
"net/http"

"github.com/micromdm/nanodep/client"
"github.com/micromdm/nanodep/log"
"github.com/micromdm/nanodep/log/ctxlog"

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

// RetrieveConfigHandler returns the DEP server config for the DEP
Expand Down
5 changes: 3 additions & 2 deletions http/api/tokenpki.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ import (
"strconv"

"github.com/micromdm/nanodep/client"
"github.com/micromdm/nanodep/log"
"github.com/micromdm/nanodep/log/ctxlog"
"github.com/micromdm/nanodep/tokenpki"

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

type TokenPKIStagingRetriever interface {
Expand Down
5 changes: 3 additions & 2 deletions http/api/tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (
"net/http"

"github.com/micromdm/nanodep/client"
"github.com/micromdm/nanodep/log"
"github.com/micromdm/nanodep/log/ctxlog"

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

var CKMismatch = errors.New("mismatched consumer key")
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/micromdm/nanodep/log"
"github.com/micromdm/nanodep/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.

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

This file was deleted.

5 changes: 3 additions & 2 deletions proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import (
"sync"

"github.com/micromdm/nanodep/client"
"github.com/micromdm/nanodep/log"
"github.com/micromdm/nanodep/log/ctxlog"

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

// New creates new NanoDEP ReverseProxy. It dispatches requests using transport
Expand Down
5 changes: 3 additions & 2 deletions sync/assigner.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (
"time"

"github.com/micromdm/nanodep/godep"
"github.com/micromdm/nanodep/log"
"github.com/micromdm/nanodep/log/ctxlog"

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

type AssignerProfileRetriever interface {
Expand Down
5 changes: 3 additions & 2 deletions sync/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import (
"time"

"github.com/micromdm/nanodep/godep"
"github.com/micromdm/nanodep/log"
"github.com/micromdm/nanodep/log/ctxlog"

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

// CursorStorage is where the device fetch and sync cursor can be stored and
Expand Down