本文整理汇总了Golang中github.com/jrperritt/rack/internal/github.com/Sirupsen/logrus.Logger.Info方法的典型用法代码示例。如果您正苦于以下问题:Golang Logger.Info方法的具体用法?Golang Logger.Info怎么用?Golang Logger.Info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/jrperritt/rack/internal/github.com/Sirupsen/logrus.Logger
的用法示例。
在下文中一共展示了Logger.Info方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: authFromScratch
func authFromScratch(credsResult *CredentialsResult, serviceType string, urlType gophercloud.Availability, logger *logrus.Logger) (*gophercloud.ServiceClient, error) {
logger.Info("Not using cache; Authenticating from scratch.\n")
ao := credsResult.AuthOpts
region := credsResult.Region
pc, err := rackspace.AuthenticatedClient(*ao)
if err != nil {
switch err.(type) {
case *tokens2.ErrNoPassword:
return nil, errors.New("Please supply an API key.")
}
return nil, err
}
pc.HTTPClient = newHTTPClient()
var sc *gophercloud.ServiceClient
switch serviceType {
case "compute":
sc, err = rackspace.NewComputeV2(pc, gophercloud.EndpointOpts{
Region: region,
Availability: urlType,
})
break
case "object-store":
sc, err = rackspace.NewObjectStorageV1(pc, gophercloud.EndpointOpts{
Region: region,
Availability: urlType,
})
break
case "blockstorage":
sc, err = rackspace.NewBlockStorageV1(pc, gophercloud.EndpointOpts{
Region: region,
Availability: urlType,
})
break
case "network":
sc, err = rackspace.NewNetworkV2(pc, gophercloud.EndpointOpts{
Region: region,
Availability: urlType,
})
break
}
if err != nil {
return nil, err
}
if sc == nil {
return nil, fmt.Errorf("Unable to create service client: Unknown service type: %s\n", serviceType)
}
if sc.Endpoint == "/" {
return nil, fmt.Errorf(strings.Join([]string{"You wanted to use service net for the %s request",
"but the %s service doesn't have an internal URL.\n"}, " "), serviceType, serviceType)
}
logger.Debugf("Created %s service client: %+v", serviceType, sc)
sc.UserAgent.Prepend(util.UserAgent)
return sc, nil
}
示例2: authFromScratch
func authFromScratch(credsResult *CredentialsResult, serviceType string, logger *logrus.Logger) (*gophercloud.ServiceClient, error) {
logger.Info("Not using cache; Authenticating from scratch.\n")
ao := credsResult.AuthOpts
region := credsResult.Region
pc, err := rackspace.AuthenticatedClient(*ao)
if err != nil {
return nil, err
}
pc.HTTPClient = newHTTPClient()
var sc *gophercloud.ServiceClient
switch serviceType {
case "compute":
sc, err = rackspace.NewComputeV2(pc, gophercloud.EndpointOpts{
Region: region,
})
break
case "object-store":
sc, err = rackspace.NewObjectStorageV1(pc, gophercloud.EndpointOpts{
Region: region,
})
break
case "blockstorage":
sc, err = rackspace.NewBlockStorageV1(pc, gophercloud.EndpointOpts{
Region: region,
})
break
case "network":
sc, err = rackspace.NewNetworkV2(pc, gophercloud.EndpointOpts{
Region: region,
})
break
}
if err != nil {
return nil, err
}
if sc == nil {
return nil, fmt.Errorf("Unable to create service client: Unknown service type: %s\n", serviceType)
}
sc.UserAgent.Prepend(util.UserAgent)
return sc, nil
}