本文整理匯總了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
}