本文整理汇总了Golang中github.com/james-nesbitt/coach/log.Log.Debug方法的典型用法代码示例。如果您正苦于以下问题:Golang Log.Debug方法的具体用法?Golang Log.Debug怎么用?Golang Log.Debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/james-nesbitt/coach/log.Log
的用法示例。
在下文中一共展示了Log.Debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Run
func (operation *BuildOperation) Run(logger log.Log) bool {
logger.Info("Running operation: build")
logger.Debug(log.VERBOSITY_DEBUG, "Run:Targets", operation.targets.TargetOrder())
for _, targetID := range operation.targets.TargetOrder() {
target, targetExists := operation.targets.Target(targetID)
if !targetExists {
// this is strange
logger.Warning("Internal target error, was told to use a target that doesn't exist")
continue
}
node, hasNode := target.Node()
nodeLogger := logger.MakeChild(targetID)
if !hasNode {
nodeLogger.Info("No node [" + node.MachineName() + "]")
} else if !node.Can("build") {
nodeLogger.Info("Node doesn't build [" + node.MachineName() + "]")
} else {
nodeLogger.Message("Building node")
node.Client().Build(nodeLogger, operation.force)
}
}
return true
}
示例2: from_Default
/**
* This is a fallback client builder, which builds the default
* coach client. The default coach client is currently the
* FSouza Docker client, configured to use ENV settings, or
* a local socket.
*/
func (clientFactories *ClientFactories) from_Default(logger log.Log, project *conf.Project) {
clientFactorySettings := &FSouza_ClientFactorySettings{}
clientType := "fsouza"
if DockerHost := os.Getenv("DOCKER_HOST"); DockerHost == "" {
logger.Debug(log.VERBOSITY_DEBUG, "No local environment DOCKER settings found, assuming a locally running docker client will be found.")
clientFactorySettings.Host = "unix:///var/run/docker.sock"
} else {
clientFactorySettings.Host = DockerHost
}
// if we have no cert path, and we are going to use a TCP socket, test for a default cert path.
if DockerCertPath := os.Getenv("DOCKER_CERT_PATH"); DockerCertPath != "" {
clientFactorySettings.CertPath = DockerCertPath
}
factory := FSouza_ClientFactory{}
if !factory.Init(logger, project, ClientFactorySettings(clientFactorySettings)) {
logger.Error("Failed to initialize FSouza factory from client factory configuration")
}
// Add this factory to the factory list
logger.Debug(log.VERBOSITY_DEBUG_LOTS, "Client Factory Created [Client_DockerFSouzaFactory]", factory)
clientFactories.AddClientFactory(clientType, ClientFactory(&factory))
}
示例3: Run
func (operation *InfoOperation) Run(logger log.Log) bool {
logger.Message("RUNNING INFO OPERATION")
logger.Debug(log.VERBOSITY_DEBUG, "Run:Targets", operation.targets.TargetOrder())
for _, targetID := range operation.targets.TargetOrder() {
target, targetExists := operation.targets.Target(targetID)
node, hasNode := target.Node()
_, hasInstances := target.Instances()
if !targetExists {
// this is strange
logger.Warning("Internal target error, was told to use a target that doesn't exist")
continue
}
nodeLogger := logger.MakeChild(targetID)
if hasNode {
nodeLogger.Message(targetID + " Information")
node.Client().NodeInfo(nodeLogger)
} else {
nodeLogger.Message("No node [" + node.MachineName() + "]")
}
if hasInstances {
node.Instances().Client().InstancesInfo(nodeLogger)
} else {
nodeLogger.Message("|-- No instances [" + node.MachineName() + "]")
}
}
return true
}
示例4: Run
func (operation *CreateOperation) Run(logger log.Log) bool {
logger.Info("Running operation: create")
logger.Debug(log.VERBOSITY_DEBUG, "Run:Targets", operation.targets.TargetOrder())
for _, targetID := range operation.targets.TargetOrder() {
target, targetExists := operation.targets.Target(targetID)
if !targetExists {
// this is strange
logger.Warning("Internal target error, was told to use a target that doesn't exist")
continue
}
node, hasNode := target.Node()
instances, hasInstances := target.Instances()
nodeLogger := logger.MakeChild(targetID)
if !hasNode {
nodeLogger.Warning("No node [" + node.MachineName() + "]")
} else if !node.Can("create") {
nodeLogger.Info("Node doesn't create [" + node.MachineName() + ":" + node.Type() + "]")
} else if !hasInstances {
nodeLogger.Info("No valid instances specified in target list [" + node.MachineName() + "]")
} else {
nodeLogger.Message("Creating instance containers")
for _, id := range instances.InstancesOrder() {
instance, _ := instances.Instance(id)
instance.Client().Create(logger, []string{}, operation.force)
}
}
}
return true
}
示例5: Init
// Constructor for BaseNode
func (node *BaseNode) Init(logger log.Log, name string, project *conf.Project, client Client, instancesSettings InstancesSettings) bool {
node.log = logger
node.conf = project
node.name = name
node.client = client
node.manualDependencies = []string{}
instancesMachineName := node.MachineName()
settingsInterface := instancesSettings.Settings()
switch settingsInterface.(type) {
case FixedInstancesSettings:
node.instances = Instances(&FixedInstances{})
instancesMachineName += "_fixed_"
case TemporaryInstancesSettings:
node.instances = Instances(&TemporaryInstances{})
instancesMachineName += "_temp_"
case ScaledInstancesSettings:
node.instances = Instances(&ScaledInstances{})
instancesMachineName += "_scaled_"
case SingleInstancesSettings:
node.instances = Instances(&SingleInstances{})
default:
node.instances = Instances(&SingleInstances{})
}
node.instances.Init(logger, instancesMachineName, client, instancesSettings)
logger.Debug(log.VERBOSITY_DEBUG_STAAAP, "Built new node:", node.client)
return true
}
示例6: Init
func (clientFactory *FSouza_ClientFactory) Init(logger log.Log, project *conf.Project, settings ClientFactorySettings) bool {
clientFactory.log = logger
clientFactory.conf = project
// make sure that the settings that were given, where the proper "FSouza_ClientFactory" type
typedSettings := settings.Settings()
switch asserted := typedSettings.(type) {
case *FSouza_ClientFactorySettings:
clientFactory.settings = *asserted
default:
logger.Error("Invalid settings type passed to Fsouza Factory")
logger.Debug(log.VERBOSITY_DEBUG, "Settings passed:", asserted)
}
// if we haven't made an actual fsouza docker client, then do it now
if clientFactory.client == nil {
if client, pk := clientFactory.makeFsouzaClientWrapper(logger.MakeChild("fsouza")); pk {
clientFactory.client = client
return true
} else {
logger.Error("Failed to create actual FSouza Docker client from client factory configuration")
return false
}
}
return true
}
示例7: Init
func (node *PullNode) Init(logger log.Log, name string, project *conf.Project, client Client, instancesSettings InstancesSettings) bool {
node.BaseNode.Init(logger, name, project, client, instancesSettings)
settingsInterface := instancesSettings.Settings()
switch settingsInterface.(type) {
case FixedInstancesSettings:
logger.Warning("Pull node cannot be configured to use fixed instances. Using null instance instead.")
node.defaultInstances(logger, client, instancesSettings)
case ScaledInstancesSettings:
logger.Warning("Pull node cannot be configured to use scaled instances. Using null instance instead.")
node.defaultInstances(logger, client, instancesSettings)
case SingleInstancesSettings:
logger.Warning("Pull node cannot be configured to use single instances. Using null instance instead.")
node.defaultInstances(logger, client, instancesSettings)
case TemporaryInstancesSettings:
logger.Warning("Pull node cannot be configured to use disposable instances. Using null instance instead.")
node.defaultInstances(logger, client, instancesSettings)
default:
node.defaultInstances(logger, client, instancesSettings)
}
node.instances.Init(logger, node.MachineName(), client, instancesSettings)
logger.Debug(log.VERBOSITY_DEBUG_STAAAP, "Built new node:", node.client)
return true
}
示例8: Run
func (operation *StatusOperation) Run(logger log.Log) bool {
logger.Message("RUNNING Status OPERATION")
logger.Debug(log.VERBOSITY_DEBUG, "Run:Targets", operation.targets.TargetOrder())
for _, targetID := range operation.targets.TargetOrder() {
target, targetExists := operation.targets.Target(targetID)
node, hasNode := target.Node()
instances, hasInstances := target.Instances()
if !targetExists {
// this is strange
logger.Warning("Internal target error, was told to use a target that doesn't exist")
continue
}
nodeLogger := logger.MakeChild(targetID)
status := []string{}
if hasNode {
status = append(status, operation.NodeStatus(nodeLogger, node)...)
} else {
status = append(status, "No node for target")
}
if hasInstances {
status = append(status, operation.InstancesStatus(nodeLogger, instances)...)
} else {
status = append(status, "No instances for target")
}
nodeLogger.Message("[" + strings.Join(status, "][") + "]")
}
return true
}
示例9: configureProject
// Use the secrets yaml object to configure a project
func (secrets *secrets_Yaml) configureProject(logger log.Log, project *Project) bool {
for key, value := range secrets.Secrets {
project.SetToken(key, value)
}
logger.Debug(log.VERBOSITY_DEBUG_STAAAP, "Configured project from YAML secrets")
return true
}
示例10: from_ConfYamlBytes
// Try to configure a project by parsing yaml from a byte stream
func (project *Project) from_ConfYamlBytes(logger log.Log, yamlBytes []byte) bool {
// parse the config file contents as a ConfSource_projectyaml object
source := new(conf_Yaml)
if err := yaml.Unmarshal(yamlBytes, source); err != nil {
logger.Warning("YAML parsing error : " + err.Error())
return false
}
logger.Debug(log.VERBOSITY_DEBUG_STAAAP, "YAML source:", *source)
return source.configureProject(logger, project)
}
示例11: Prepare
func (instances *SingleInstances) Prepare(logger log.Log, client Client, nodes *Nodes, node Node) bool {
instances.log = logger
logger.Debug(log.VERBOSITY_DEBUG_WOAH, "Prepare: Single Instances")
instances.instance = SingleInstance{}
instances.instance.Init(logger, INSTANCE_SINGLE_ID, instances.MachineName(), client, true)
instances.log.Debug(log.VERBOSITY_DEBUG_WOAH, "Created single instance", instances.instance)
return true
}
示例12: Pull
func (client *FSouza_NodeClient) Pull(logger log.Log, force bool) bool {
image, tag := client.GetImageName()
actionCacheTag := "pull:" + image + ":" + tag
if _, ok := actionCache[actionCacheTag]; ok {
logger.Message("Node image [" + image + ":" + tag + "] was just pulled, so not pulling it again.")
return true
}
if !force && client.HasImage() {
logger.Info("Node already has an image [" + image + ":" + tag + "], so not pulling it again. You can force this operation if you want to pull this image.")
return false
}
options := docker.PullImageOptions{
Repository: image,
OutputStream: logger,
RawJSONStream: false,
}
if tag != "" {
options.Tag = tag
}
var auth docker.AuthConfiguration
// var ok bool
//options.Registry = "https://index.docker.io/v1/"
// auths, _ := docker.NewAuthConfigurationsFromDockerCfg()
// if auth, ok = auths.Configs[registry]; ok {
// options.Registry = registry
// } else {
// node.log.Warning("You have no local login credentials for any repo. Defaulting to no login.")
auth = docker.AuthConfiguration{}
options.Registry = "https://index.docker.io/v1/"
// }
logger.Message("Pulling node image [" + image + ":" + tag + "] from server [" + options.Registry + "] using auth [" + auth.Username + "] : " + image + ":" + tag)
logger.Debug(log.VERBOSITY_DEBUG_LOTS, "AUTH USED: ", map[string]string{"Username": auth.Username, "Password": auth.Password, "Email": auth.Email, "ServerAdddress": auth.ServerAddress})
// ask the docker client to build the image
err := client.backend.PullImage(options, auth)
if err != nil {
logger.Error("Node image not pulled : " + image + " => " + err.Error())
actionCache[actionCacheTag] = false
return false
} else {
client.backend.Refresh(true, false)
logger.Message("Node image pulled: " + image + ":" + tag)
actionCache[actionCacheTag] = false
return true
}
}
示例13: Run
func (operation *ScaleOperation) Run(logger log.Log) bool {
logger.Info("Running operation: scale")
logger.Debug(log.VERBOSITY_DEBUG, "Run:Targets", operation.targets.TargetOrder())
if operation.scale == 0 {
operation.log.Warning("scale operation was told to scale to 0")
return false
}
for _, targetID := range operation.targets.TargetOrder() {
target, targetExists := operation.targets.Target(targetID)
if !targetExists {
// this is strange
logger.Warning("Internal target error, was told to use a target that doesn't exist")
continue
}
node, hasNode := target.Node()
nodeLogger := logger.MakeChild(targetID)
if !hasNode {
nodeLogger.Info("No node [" + node.MachineName() + "]")
} else if !node.Can("scale") {
nodeLogger.Info("Node doesn't Scale [" + node.MachineName() + "]")
} else {
nodeLogger.Message("Scaling node " + node.Id())
if operation.scale > 0 {
count := operation.ScaleUpNumber(nodeLogger, node.Instances(), operation.scale)
if count == 0 {
nodeLogger.Warning("Scale operation could not scale up any new instances of node")
} else if count < operation.scale {
nodeLogger.Warning("Scale operation could not scale up all of the requested instances of node. " + strconv.FormatInt(int64(count+1), 10) + " started.")
} else {
nodeLogger.Message("Scale operation scaled up " + strconv.FormatInt(int64(count), 10) + " instances")
}
} else {
count := operation.ScaleDownNumber(nodeLogger, node.Instances(), -operation.scale)
if count == 0 {
nodeLogger.Warning("Scale operation could not scale down any new instances of node")
} else if count < (-operation.scale) {
nodeLogger.Warning("Scale operation could not scale down all of the requested instances of node. " + strconv.FormatInt(int64(count+1), 10) + " stopped.")
} else {
nodeLogger.Message("Scale operation scaled down " + strconv.FormatInt(int64(count), 10) + " instances")
}
}
}
}
return true
}
示例14: from_NodesYamlFilePath
// Try to configure a project by parsing yaml from a conf file
func (nodes *Nodes) from_NodesYamlFilePath(logger log.Log, project *conf.Project, clientFactories *ClientFactories, yamlFilePath string, overwrite bool) bool {
// read the config file
yamlFile, err := ioutil.ReadFile(yamlFilePath)
if err != nil {
logger.Debug(log.VERBOSITY_DEBUG_LOTS, "Could not read a YAML file: "+err.Error())
return false
}
if !nodes.from_NodesYamlBytes(logger.MakeChild(yamlFilePath), project, clientFactories, yamlFile, overwrite) {
logger.Warning("YAML marshalling of the YAML nodes file failed [" + yamlFilePath + "]: " + err.Error())
return false
}
return true
}
示例15: from_ConfYamlFilePath
// Try to configure a project by parsing yaml from a conf file
func (project *Project) from_ConfYamlFilePath(logger log.Log, yamlFilePath string) bool {
// read the config file
yamlFile, err := ioutil.ReadFile(yamlFilePath)
if err != nil {
logger.Debug(log.VERBOSITY_DEBUG_LOTS, "Could not read a YAML file: "+err.Error())
return false
}
if !project.from_ConfYamlBytes(logger.MakeChild(yamlFilePath), yamlFile) {
logger.Warning("YAML marshalling of the YAML conf file failed [" + yamlFilePath + "]: " + err.Error())
return false
}
return true
}