func NewWithLog(l hclog.Logger) (*Client, error) {
	if viper.GetString("core.conf") == "" {
		viper.Set("core.conf", filepath.Dir(viper.ConfigFileUsed()))
		l.Debug("Config relative load path set", "path", viper.GetString("core.conf"))
	}
	conn, err := connect(false)
	if err != nil {
		return nil, err
	}
	cache, err := cache.NewTokenCache(viper.GetString("token.cache"))
	if err != nil {
		return nil, err
	}
	token.SetParentLogger(l)
	startup.DoCallbacks()
	ts, err := token.New(viper.GetString("token.backend"))
	if err != nil {
		l.Warn("Token service initialization error", "error", err)
	}
	hn, err := os.Hostname()
	if err != nil {
		viper.SetDefault("client.ID", "BOGUS_CLIENT")
	} else {
		viper.SetDefault("client.ID", hn)
	}
	return &Client{
		TokenCache: cache,
		Service:    ts,
		rpc:        rpc.NewNetAuth2Client(conn),
		log:        l,
		clientName: viper.GetString("client.ID"),
	}, nil
}
NewWithLog uses the specified logger to contruct a NetAuth client.
Note that the log handler cannot be changed after setup, so the
handler that is provided should have the correct name and be
parented to the correct point on the log tree.
package netauth
import (
	"fmt"
	"os"
	"path/filepath"
	"github.com/spf13/viper"
	"github.com/hashicorp/go-hclog"
	"google.golang.org/grpc"
	"google.golang.org/grpc/credentials"
	"github.com/netauth/netauth/internal/startup"
	"github.com/netauth/netauth/internal/token"
	"github.com/netauth/netauth/pkg/netauth/cache"
	_ "github.com/netauth/netauth/internal/token/jwt"
	_ "github.com/netauth/netauth/pkg/netauth/cache/memory"
	rpc "github.com/netauth/protocol/v2"
)
func init() {
	viper.SetDefault("core.port", 1729)
	viper.SetDefault("tls.certificate", "keys/tls.pem")
	viper.SetDefault("token.cache", "memory")
	viper.SetDefault("token.backend", "jwt-rsa")
}