logging: Show the package name in log lines from catalog.go
@@ -9,7 +9,7 @@ import (
)
func (sc *MeshCatalog) refreshCache() {
- glog.Info("[catalog] Refresh cache...")
+ glog.Infof("[%s] Refresh cache...", packageName)
servicesCache := make(map[endpoint.WeightedService][]endpoint.Endpoint)
serviceAccountsCache := make(map[endpoint.NamespacedServiceAccount][]endpoint.NamespacedService)
// TODO(draychev): split the namespace from the service name -- non-K8s services won't have namespace
@@ -19,10 +19,10 @@ func (sc *MeshCatalog) refreshCache() {
for _, provider := range sc.endpointsProviders {
newIps := provider.ListEndpointsForService(endpoint.ServiceName(service.ServiceName.String()))
if len(newIps) == 0 {
- glog.Infof("[catalog][%s] No IPs found for service=%s", provider.GetID(), service.ServiceName)
+ glog.Infof("[%s][%s] No IPs found for service=%s", packageName, provider.GetID(), service.ServiceName)
continue
}
- glog.V(level.Trace).Infof("[catalog][%s] Found IPs=%+v for service=%s", provider.GetID(), endpointsToString(newIps), service.ServiceName)
+ glog.V(level.Trace).Infof("[%s][%s] Found IPs=%+v for service=%s", packageName, provider.GetID(), endpointsToString(newIps), service.ServiceName)
if existingIps, exists := servicesCache[service]; exists {
servicesCache[service] = append(existingIps, newIps...)
} else {
@@ -35,13 +35,13 @@ func (sc *MeshCatalog) refreshCache() {
for _, provider := range sc.endpointsProviders {
// TODO (snchh) : remove this provider check once we have figured out the service account story for azure vms
if provider.GetID() != constants.AzureProviderName {
- glog.V(level.Trace).Infof("[catalog][%s] Finding Services for servcie acccount =%s", provider.GetID(), namespacesServiceAccounts)
+ glog.V(level.Trace).Infof("[%s][%s] Finding Services for servcie acccount =%s", packageName, provider.GetID(), namespacesServiceAccounts)
newServices := provider.ListServicesForServiceAccount(namespacesServiceAccounts)
if len(newServices) == 0 {
- glog.V(level.Trace).Infof("[catalog][%s] No services found for service account=%s", provider.GetID(), namespacesServiceAccounts)
+ glog.V(level.Trace).Infof("[%s][%s] No services found for service account=%s", packageName, provider.GetID(), namespacesServiceAccounts)
continue
}
- glog.V(level.Trace).Infof("[catalog][%s] Found services=%+v for service account=%s", provider.GetID(), newServices, namespacesServiceAccounts)
+ glog.V(level.Trace).Infof("[%s][%s] Found services=%+v for service account=%s", packageName, provider.GetID(), newServices, namespacesServiceAccounts)
if existingServices, exists := serviceAccountsCache[namespacesServiceAccounts]; exists {
// append only new services i.e. preventing duplication
for _, service := range newServices {
@@ -61,8 +61,8 @@ func (sc *MeshCatalog) refreshCache() {
}
}
}
- glog.Infof("[catalog] Services cache: %+v", servicesCache)
- glog.Infof("[catalog] ServiceAccounts cache: %+v", serviceAccountsCache)
+ glog.Infof("[%s] Services cache: %+v", packageName, servicesCache)
+ glog.Infof("[%s] ServiceAccounts cache: %+v", packageName, serviceAccountsCache)
sc.servicesMutex.Lock()
sc.servicesCache = servicesCache
sc.serviceAccountsCache = serviceAccountsCache
