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

del init print log path #637

Merged
merged 1 commit into from
Jul 24, 2023
Merged
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
15 changes: 6 additions & 9 deletions clients/nacos_client/nacos_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"github.com/nacos-group/nacos-sdk-go/v2/common/constant"
"github.com/nacos-group/nacos-sdk-go/v2/common/file"
"github.com/nacos-group/nacos-sdk-go/v2/common/http_agent"
"github.com/nacos-group/nacos-sdk-go/v2/common/logger"
)

type NacosClient struct {
Expand All @@ -36,7 +35,7 @@ type NacosClient struct {
serverConfigs []constant.ServerConfig
}

//SetClientConfig is use to set nacos client Config
// SetClientConfig is use to set nacos client Config
func (client *NacosClient) SetClientConfig(config constant.ClientConfig) (err error) {
if config.TimeoutMs <= 0 {
config.TimeoutMs = 10 * 1000
Expand All @@ -62,15 +61,13 @@ func (client *NacosClient) SetClientConfig(config constant.ClientConfig) (err er
config.LogDir = file.GetCurrentPath() + string(os.PathSeparator) + "log"
}

logger.Infof("logDir:<%s> cacheDir:<%s>", config.LogDir, config.CacheDir)

client.clientConfig = config
client.clientConfigValid = true

return
}

//SetServerConfig is use to set nacos server config
// SetServerConfig is use to set nacos server config
func (client *NacosClient) SetServerConfig(configs []constant.ServerConfig) (err error) {
if len(configs) <= 0 {
//it's may be use endpoint to get nacos server address
Expand All @@ -95,7 +92,7 @@ func (client *NacosClient) SetServerConfig(configs []constant.ServerConfig) (err
return
}

//GetClientConfig use to get client config
// GetClientConfig use to get client config
func (client *NacosClient) GetClientConfig() (config constant.ClientConfig, err error) {
config = client.clientConfig
if !client.clientConfigValid {
Expand All @@ -104,7 +101,7 @@ func (client *NacosClient) GetClientConfig() (config constant.ClientConfig, err
return
}

//GetServerConfig use to get server config
// GetServerConfig use to get server config
func (client *NacosClient) GetServerConfig() (configs []constant.ServerConfig, err error) {
configs = client.serverConfigs
if !client.serverConfigsValid {
Expand All @@ -113,7 +110,7 @@ func (client *NacosClient) GetServerConfig() (configs []constant.ServerConfig, e
return
}

//SetHttpAgent use to set http agent
// SetHttpAgent use to set http agent
func (client *NacosClient) SetHttpAgent(agent http_agent.IHttpAgent) (err error) {
if agent == nil {
err = errors.New("[client.SetHttpAgent] http agent can not be nil")
Expand All @@ -123,7 +120,7 @@ func (client *NacosClient) SetHttpAgent(agent http_agent.IHttpAgent) (err error)
return
}

//GetHttpAgent use to get http agent
// GetHttpAgent use to get http agent
func (client *NacosClient) GetHttpAgent() (agent http_agent.IHttpAgent, err error) {
if client.agent == nil {
err = errors.New("[client.GetHttpAgent] invalid http agent")
Expand Down