Merge lp:~thumper/juju-core/update-loggo into lp:~juju/juju-core/trunk

Proposed by Tim Penhey
Status: Merged
Merged at revision: 1263
Proposed branch: lp:~thumper/juju-core/update-loggo
Merge into: lp:~juju/juju-core/trunk
Diff against target: 352 lines (+43/-45)
9 files modified
cmd/builddb/main.go (+5/-5)
cmd/juju/main_test.go (+1/-1)
cmd/logging.go (+3/-3)
cmd/logging_test.go (+2/-4)
log/log.go (+5/-5)
testing/log.go (+2/-2)
worker/provisioner/provisioner.go (+2/-2)
worker/provisioner/provisioner_task.go (+22/-22)
worker/uniter/jujuc/juju-log_test.go (+1/-1)
To merge this branch: bzr merge lp:~thumper/juju-core/update-loggo
Reviewer Review Type Date Requested Status
Juju Engineering Pending
Review via email: mp+168342@code.launchpad.net

Description of the change

Updates for latest loggo.

Since we don't yet have dependency management, the latest
changes to loggo are unpushed until I get this agreed upon.

https://codereview.appspot.com/10125046/

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote :
Download full text (12.6 KiB)

Reviewers: mp+168342_code.launchpad.net,

Message:
Please take a look.

Description:
Updates for latest loggo.

Since we don't yet have dependency management, the latest
changes to loggo are unpushed until I get this agreed upon.

https://code.launchpad.net/~thumper/juju-core/update-loggo/+merge/168342

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/10125046/

Affected files:
   A [revision details]
   M cmd/builddb/main.go
   M cmd/juju/main_test.go
   M cmd/logging.go
   M cmd/logging_test.go
   M log/log.go
   M testing/log.go
   M worker/provisioner/provisioner.go
   M worker/provisioner/provisioner_task.go
   M worker/uniter/jujuc/juju-log_test.go

Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision: <email address hidden>

Index: cmd/logging.go
=== modified file 'cmd/logging.go'
--- cmd/logging.go 2013-06-07 01:00:23 +0000
+++ cmd/logging.go 2013-06-10 04:25:51 +0000
@@ -57,9 +57,9 @@
    if l.Debug {
     level = loggo.DEBUG
    }
- logger := loggo.GetLogger("juju")
- logger.SetLogLevel(level)
+ // Set the level on the root logger.
+ loggo.GetLogger("").SetLogLevel(level)
   }
- loggo.ConfigureLogging(l.Config)
+ loggo.ConfigureLoggers(l.Config)
   return nil
  }

Index: cmd/logging_test.go
=== modified file 'cmd/logging_test.go'
--- cmd/logging_test.go 2013-06-06 03:55:22 +0000
+++ cmd/logging_test.go 2013-06-10 04:25:51 +0000
@@ -46,8 +46,7 @@
   err := l.Start(ctx)
   c.Assert(err, IsNil)

- logger := loggo.GetLogger("juju")
- c.Assert(logger.GetLogLevel(), Equals, loggo.INFO)
+ c.Assert(loggo.GetLogger("").LogLevel(), Equals, loggo.INFO)
  }

  func (s *LogSuite) TestDebugSetsLogLevel(c *C) {
@@ -56,8 +55,7 @@
   err := l.Start(ctx)
   c.Assert(err, IsNil)

- logger := loggo.GetLogger("juju")
- c.Assert(logger.GetLogLevel(), Equals, loggo.DEBUG)
+ c.Assert(loggo.GetLogger("").LogLevel(), Equals, loggo.DEBUG)
  }

  func (s *LogSuite) TestStderr(c *C) {

Index: cmd/builddb/main.go
=== modified file 'cmd/builddb/main.go'
--- cmd/builddb/main.go 2013-05-29 05:29:57 +0000
+++ cmd/builddb/main.go 2013-06-10 04:25:51 +0000
@@ -57,13 +57,13 @@
    return err
   }

- logger.Info("Waiting for unit to reach %q status...",
params.StatusStarted)
+ logger.Infof("Waiting for unit to reach %q status...",
params.StatusStarted)
   unit := units[0]
   last, info, err := unit.Status()
   if err != nil {
    return err
   }
- logger.Info("Unit status is %q: %s", last, info)
+ logger.Infof("Unit status is %q: %s", last, info)
   for last != params.StatusStarted {
    time.Sleep(2 * time.Second)
    if err := unit.Refresh(); err != nil {
@@ -74,7 +74,7 @@
     return err
    }
    if status != last {
- logger.Info("Unit status is %q: %s", status, info)
+ logger.Infof("Unit status is %q: %s", status, info)
     last = status
    }
   }
@@ -82,7 +82,7 @@
   if !ok {
    return fmt.Errorf("cannot retrieve files: build unit lacks a
public-address...

Revision history for this message
John A Meinel (jameinel) wrote :

You didn't really summarize what the changes are. I'm guessing it is
mostly changing names from "Info" to "Infof" to follow the common idiom
that things which take a format + args end in an extra 'f'. (printf,
etc).

I think I'm fine with that, but I haven't seen it discussed.

LGTM

https://codereview.appspot.com/10125046/

Revision history for this message
Roger Peppe (rogpeppe) wrote :
Download full text (16.7 KiB)

LGTM

could I suggest also adding the various log functions to
.lbox.check ? perhaps as a separate CL

(I believe the version check should change there - currently
it checks that the Go version is devel, but 1.1 is also
sufficient now).

On 10 June 2013 05:31, Tim Penhey <email address hidden> wrote:
> Reviewers: mp+168342_code.launchpad.net,
>
> Message:
> Please take a look.
>
> Description:
> Updates for latest loggo.
>
> Since we don't yet have dependency management, the latest
> changes to loggo are unpushed until I get this agreed upon.
>
> https://code.launchpad.net/~thumper/juju-core/update-loggo/+merge/168342
>
> (do not edit description out of merge proposal)
>
>
> Please review this at https://codereview.appspot.com/10125046/
>
> Affected files:
> A [revision details]
> M cmd/builddb/main.go
> M cmd/juju/main_test.go
> M cmd/logging.go
> M cmd/logging_test.go
> M log/log.go
> M testing/log.go
> M worker/provisioner/provisioner.go
> M worker/provisioner/provisioner_task.go
> M worker/uniter/jujuc/juju-log_test.go
>
>
> Index: [revision details]
> === added file '[revision details]'
> --- [revision details] 2012-01-01 00:00:00 +0000
> +++ [revision details] 2012-01-01 00:00:00 +0000
> @@ -0,0 +1,2 @@
> +Old revision: <email address hidden>
> +New revision: <email address hidden>
>
> Index: cmd/logging.go
> === modified file 'cmd/logging.go'
> --- cmd/logging.go 2013-06-07 01:00:23 +0000
> +++ cmd/logging.go 2013-06-10 04:25:51 +0000
> @@ -57,9 +57,9 @@
> if l.Debug {
> level = loggo.DEBUG
> }
> - logger := loggo.GetLogger("juju")
> - logger.SetLogLevel(level)
> + // Set the level on the root logger.
> + loggo.GetLogger("").SetLogLevel(level)
> }
> - loggo.ConfigureLogging(l.Config)
> + loggo.ConfigureLoggers(l.Config)
> return nil
> }
>
>
> Index: cmd/logging_test.go
> === modified file 'cmd/logging_test.go'
> --- cmd/logging_test.go 2013-06-06 03:55:22 +0000
> +++ cmd/logging_test.go 2013-06-10 04:25:51 +0000
> @@ -46,8 +46,7 @@
> err := l.Start(ctx)
> c.Assert(err, IsNil)
>
> - logger := loggo.GetLogger("juju")
> - c.Assert(logger.GetLogLevel(), Equals, loggo.INFO)
> + c.Assert(loggo.GetLogger("").LogLevel(), Equals, loggo.INFO)
> }
>
> func (s *LogSuite) TestDebugSetsLogLevel(c *C) {
> @@ -56,8 +55,7 @@
> err := l.Start(ctx)
> c.Assert(err, IsNil)
>
> - logger := loggo.GetLogger("juju")
> - c.Assert(logger.GetLogLevel(), Equals, loggo.DEBUG)
> + c.Assert(loggo.GetLogger("").LogLevel(), Equals, loggo.DEBUG)
> }
>
> func (s *LogSuite) TestStderr(c *C) {
>
>
> Index: cmd/builddb/main.go
> === modified file 'cmd/builddb/main.go'
> --- cmd/builddb/main.go 2013-05-29 05:29:57 +0000
> +++ cmd/builddb/main.go 2013-06-10 04:25:51 +0000
> @@ -57,13 +57,13 @@
> return err
> }
>
> - logger.Info("Waiting for unit to reach %q status...",
> params.StatusStarted)
> + logger.Infof("Wai...

Revision history for this message
Roger Peppe (rogpeppe) wrote :

This CL should give some context: https://codereview.appspot.com/10043045/

On 10 June 2013 09:28, John A Meinel <email address hidden> wrote:
> You didn't really summarize what the changes are. I'm guessing it is
> mostly changing names from "Info" to "Infof" to follow the common idiom
> that things which take a format + args end in an extra 'f'. (printf,
> etc).
>
> I think I'm fine with that, but I haven't seen it discussed.
>
> LGTM
>
>
> https://codereview.appspot.com/10125046/
>
> --
> https://code.launchpad.net/~thumper/juju-core/update-loggo/+merge/168342
> Your team juju hackers is requested to review the proposed merge of lp:~thumper/juju-core/update-loggo into lp:juju-core.

Revision history for this message
Tim Penhey (thumper) wrote :

*** Submitted:

Updates for latest loggo.

Since we don't yet have dependency management, the latest
changes to loggo are unpushed until I get this agreed upon.

R=jameinel
CC=
https://codereview.appspot.com/10125046

https://codereview.appspot.com/10125046/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'cmd/builddb/main.go'
--- cmd/builddb/main.go 2013-05-29 05:29:57 +0000
+++ cmd/builddb/main.go 2013-06-10 04:33:28 +0000
@@ -57,13 +57,13 @@
57 return err57 return err
58 }58 }
5959
60 logger.Info("Waiting for unit to reach %q status...", params.StatusStarted)60 logger.Infof("Waiting for unit to reach %q status...", params.StatusStarted)
61 unit := units[0]61 unit := units[0]
62 last, info, err := unit.Status()62 last, info, err := unit.Status()
63 if err != nil {63 if err != nil {
64 return err64 return err
65 }65 }
66 logger.Info("Unit status is %q: %s", last, info)66 logger.Infof("Unit status is %q: %s", last, info)
67 for last != params.StatusStarted {67 for last != params.StatusStarted {
68 time.Sleep(2 * time.Second)68 time.Sleep(2 * time.Second)
69 if err := unit.Refresh(); err != nil {69 if err := unit.Refresh(); err != nil {
@@ -74,7 +74,7 @@
74 return err74 return err
75 }75 }
76 if status != last {76 if status != last {
77 logger.Info("Unit status is %q: %s", status, info)77 logger.Infof("Unit status is %q: %s", status, info)
78 last = status78 last = status
79 }79 }
80 }80 }
@@ -82,7 +82,7 @@
82 if !ok {82 if !ok {
83 return fmt.Errorf("cannot retrieve files: build unit lacks a public-address")83 return fmt.Errorf("cannot retrieve files: build unit lacks a public-address")
84 }84 }
85 logger.Info("Built files published at http://%s", addr)85 logger.Infof("Built files published at http://%s", addr)
86 logger.Info("Remember to destroy the environment when you're done...")86 logger.Infof("Remember to destroy the environment when you're done...")
87 return nil87 return nil
88}88}
8989
=== modified file 'cmd/juju/main_test.go'
--- cmd/juju/main_test.go 2013-06-04 21:43:25 +0000
+++ cmd/juju/main_test.go 2013-06-10 04:33:28 +0000
@@ -73,7 +73,7 @@
73}73}
7474
75func (s *MainSuite) TestTearDown(c *C) {75func (s *MainSuite) TestTearDown(c *C) {
76 loggo.ResetLogging()76 loggo.ResetLoggers()
77}77}
7878
79func (s *MainSuite) TestRunMain(c *C) {79func (s *MainSuite) TestRunMain(c *C) {
8080
=== modified file 'cmd/logging.go'
--- cmd/logging.go 2013-06-07 01:00:23 +0000
+++ cmd/logging.go 2013-06-10 04:33:28 +0000
@@ -57,9 +57,9 @@
57 if l.Debug {57 if l.Debug {
58 level = loggo.DEBUG58 level = loggo.DEBUG
59 }59 }
60 logger := loggo.GetLogger("juju")60 // Set the level on the root logger.
61 logger.SetLogLevel(level)61 loggo.GetLogger("").SetLogLevel(level)
62 }62 }
63 loggo.ConfigureLogging(l.Config)63 loggo.ConfigureLoggers(l.Config)
64 return nil64 return nil
65}65}
6666
=== modified file 'cmd/logging_test.go'
--- cmd/logging_test.go 2013-06-06 03:55:22 +0000
+++ cmd/logging_test.go 2013-06-10 04:33:28 +0000
@@ -46,8 +46,7 @@
46 err := l.Start(ctx)46 err := l.Start(ctx)
47 c.Assert(err, IsNil)47 c.Assert(err, IsNil)
4848
49 logger := loggo.GetLogger("juju")49 c.Assert(loggo.GetLogger("").LogLevel(), Equals, loggo.INFO)
50 c.Assert(logger.GetLogLevel(), Equals, loggo.INFO)
51}50}
5251
53func (s *LogSuite) TestDebugSetsLogLevel(c *C) {52func (s *LogSuite) TestDebugSetsLogLevel(c *C) {
@@ -56,8 +55,7 @@
56 err := l.Start(ctx)55 err := l.Start(ctx)
57 c.Assert(err, IsNil)56 c.Assert(err, IsNil)
5857
59 logger := loggo.GetLogger("juju")58 c.Assert(loggo.GetLogger("").LogLevel(), Equals, loggo.DEBUG)
60 c.Assert(logger.GetLogLevel(), Equals, loggo.DEBUG)
61}59}
6260
63func (s *LogSuite) TestStderr(c *C) {61func (s *LogSuite) TestStderr(c *C) {
6462
=== modified file 'log/log.go'
--- log/log.go 2013-05-30 06:54:40 +0000
+++ log/log.go 2013-06-10 04:33:28 +0000
@@ -13,31 +13,31 @@
1313
14// Errorf logs a message using the ERROR priority.14// Errorf logs a message using the ERROR priority.
15func Errorf(format string, a ...interface{}) error {15func Errorf(format string, a ...interface{}) error {
16 logger.Log(loggo.ERROR, format, a...)16 logger.Logf(loggo.ERROR, format, a...)
17 return nil17 return nil
18}18}
1919
20// Warningf logs a message using the WARNING priority.20// Warningf logs a message using the WARNING priority.
21func Warningf(format string, a ...interface{}) error {21func Warningf(format string, a ...interface{}) error {
22 logger.Log(loggo.WARNING, format, a...)22 logger.Logf(loggo.WARNING, format, a...)
23 return nil23 return nil
24}24}
2525
26// Noticef logs a message using the NOTICE priority.26// Noticef logs a message using the NOTICE priority.
27// Notice doesn't really convert to the loggo priorities...27// Notice doesn't really convert to the loggo priorities...
28func Noticef(format string, a ...interface{}) error {28func Noticef(format string, a ...interface{}) error {
29 logger.Log(loggo.INFO, format, a...)29 logger.Logf(loggo.INFO, format, a...)
30 return nil30 return nil
31}31}
3232
33// Infof logs a message using the INFO priority.33// Infof logs a message using the INFO priority.
34func Infof(format string, a ...interface{}) error {34func Infof(format string, a ...interface{}) error {
35 logger.Log(loggo.INFO, format, a...)35 logger.Logf(loggo.INFO, format, a...)
36 return nil36 return nil
37}37}
3838
39// Debugf logs a message using the DEBUG priority.39// Debugf logs a message using the DEBUG priority.
40func Debugf(format string, a ...interface{}) (err error) {40func Debugf(format string, a ...interface{}) (err error) {
41 logger.Log(loggo.DEBUG, format, a...)41 logger.Logf(loggo.DEBUG, format, a...)
42 return nil42 return nil
43}43}
4444
=== modified file 'testing/log.go'
--- testing/log.go 2013-05-31 01:40:31 +0000
+++ testing/log.go 2013-06-10 04:33:28 +0000
@@ -32,11 +32,11 @@
32func (t *LoggingSuite) SetUpTest(c *C) {32func (t *LoggingSuite) SetUpTest(c *C) {
33 loggo.ResetWriters()33 loggo.ResetWriters()
34 loggo.ReplaceDefaultWriter(&gocheckWriter{c})34 loggo.ReplaceDefaultWriter(&gocheckWriter{c})
35 loggo.ResetLogging()35 loggo.ResetLoggers()
36 loggo.GetLogger("juju").SetLogLevel(loggo.DEBUG)36 loggo.GetLogger("juju").SetLogLevel(loggo.DEBUG)
37}37}
3838
39func (t *LoggingSuite) TearDownTest(c *C) {39func (t *LoggingSuite) TearDownTest(c *C) {
40 loggo.ResetLogging()40 loggo.ResetLoggers()
41 loggo.ResetWriters()41 loggo.ResetWriters()
42}42}
4343
=== modified file 'worker/provisioner/provisioner.go'
--- worker/provisioner/provisioner.go 2013-06-10 02:52:05 +0000
+++ worker/provisioner/provisioner.go 2013-06-10 04:33:28 +0000
@@ -95,14 +95,14 @@
95 return tomb.ErrDying95 return tomb.ErrDying
96 case <-environmentProvisioner.Dying():96 case <-environmentProvisioner.Dying():
97 err := environmentProvisioner.Err()97 err := environmentProvisioner.Err()
98 logger.Error("environment provisioner died: %v", err)98 logger.Errorf("environment provisioner died: %v", err)
99 return err99 return err
100 case cfg, ok := <-environWatcher.Changes():100 case cfg, ok := <-environWatcher.Changes():
101 if !ok {101 if !ok {
102 return watcher.MustErr(environWatcher)102 return watcher.MustErr(environWatcher)
103 }103 }
104 if err := p.setConfig(cfg); err != nil {104 if err := p.setConfig(cfg); err != nil {
105 logger.Error("loaded invalid environment configuration: %v", err)105 logger.Errorf("loaded invalid environment configuration: %v", err)
106 }106 }
107 }107 }
108 }108 }
109109
=== modified file 'worker/provisioner/provisioner_task.go'
--- worker/provisioner/provisioner_task.go 2013-06-10 02:51:28 +0000
+++ worker/provisioner/provisioner_task.go 2013-06-10 04:33:28 +0000
@@ -97,7 +97,7 @@
97}97}
9898
99func (task *provisionerTask) loop() error {99func (task *provisionerTask) loop() error {
100 logger.Info("Starting up provisioner task %s", task.machineId)100 logger.Infof("Starting up provisioner task %s", task.machineId)
101 defer watcher.Stop(task.machineWatcher, &task.tomb)101 defer watcher.Stop(task.machineWatcher, &task.tomb)
102102
103 // When the watcher is started, it will have the initial changes be all103 // When the watcher is started, it will have the initial changes be all
@@ -106,7 +106,7 @@
106 for {106 for {
107 select {107 select {
108 case <-task.tomb.Dying():108 case <-task.tomb.Dying():
109 logger.Info("Shutting down provisioner task %s", task.machineId)109 logger.Infof("Shutting down provisioner task %s", task.machineId)
110 return tomb.ErrDying110 return tomb.ErrDying
111 case ids, ok := <-task.machineWatcher.Changes():111 case ids, ok := <-task.machineWatcher.Changes():
112 if !ok {112 if !ok {
@@ -115,7 +115,7 @@
115 // TODO(dfc; lp:1042717) fire process machines periodically to shut down unknown115 // TODO(dfc; lp:1042717) fire process machines periodically to shut down unknown
116 // instances.116 // instances.
117 if err := task.processMachines(ids); err != nil {117 if err := task.processMachines(ids); err != nil {
118 logger.Error("Process machines failed: %v", err)118 logger.Errorf("Process machines failed: %v", err)
119 return err119 return err
120 }120 }
121 }121 }
@@ -124,7 +124,7 @@
124}124}
125125
126func (task *provisionerTask) processMachines(ids []string) error {126func (task *provisionerTask) processMachines(ids []string) error {
127 logger.Trace("processMachines(%v)", ids)127 logger.Tracef("processMachines(%v)", ids)
128 // Populate the tasks maps of current instances and machines.128 // Populate the tasks maps of current instances and machines.
129 err := task.populateMachineMaps(ids)129 err := task.populateMachineMaps(ids)
130 if err != nil {130 if err != nil {
@@ -163,7 +163,7 @@
163163
164 instances, err := task.broker.AllInstances()164 instances, err := task.broker.AllInstances()
165 if err != nil {165 if err != nil {
166 logger.Error("failed to get all instances from broker: %v", err)166 logger.Errorf("failed to get all instances from broker: %v", err)
167 return err167 return err
168 }168 }
169 for _, i := range instances {169 for _, i := range instances {
@@ -177,12 +177,12 @@
177 machine, err := task.machineGetter.Machine(id)177 machine, err := task.machineGetter.Machine(id)
178 switch {178 switch {
179 case errors.IsNotFoundError(err):179 case errors.IsNotFoundError(err):
180 logger.Debug("machine %q not found in state", id)180 logger.Debugf("machine %q not found in state", id)
181 delete(task.machines, id)181 delete(task.machines, id)
182 case err == nil:182 case err == nil:
183 task.machines[id] = machine183 task.machines[id] = machine
184 default:184 default:
185 logger.Error("failed to get machine: %v", err)185 logger.Errorf("failed to get machine: %v", err)
186 }186 }
187 }187 }
188 return nil188 return nil
@@ -194,7 +194,7 @@
194 for _, id := range ids {194 for _, id := range ids {
195 machine, found := task.machines[id]195 machine, found := task.machines[id]
196 if !found {196 if !found {
197 logger.Info("machine %q not found", id)197 logger.Infof("machine %q not found", id)
198 continue198 continue
199 }199 }
200 switch machine.Life() {200 switch machine.Life() {
@@ -202,17 +202,17 @@
202 if _, ok := machine.InstanceId(); ok {202 if _, ok := machine.InstanceId(); ok {
203 continue203 continue
204 }204 }
205 logger.Info("killing dying, unprovisioned machine %q", machine)205 logger.Infof("killing dying, unprovisioned machine %q", machine)
206 if err := machine.EnsureDead(); err != nil {206 if err := machine.EnsureDead(); err != nil {
207 logger.Error("failed to ensure machine dead %q: %v", machine, err)207 logger.Errorf("failed to ensure machine dead %q: %v", machine, err)
208 return nil, nil, err208 return nil, nil, err
209 }209 }
210 fallthrough210 fallthrough
211 case state.Dead:211 case state.Dead:
212 dead = append(dead, machine)212 dead = append(dead, machine)
213 logger.Info("removing dead machine %q", machine)213 logger.Infof("removing dead machine %q", machine)
214 if err := machine.Remove(); err != nil {214 if err := machine.Remove(); err != nil {
215 logger.Error("failed to remove dead machine %q", machine)215 logger.Errorf("failed to remove dead machine %q", machine)
216 return nil, nil, err216 return nil, nil, err
217 }217 }
218 // now remove it from the machines map218 // now remove it from the machines map
@@ -222,16 +222,16 @@
222 if instId, hasInstId := machine.InstanceId(); !hasInstId {222 if instId, hasInstId := machine.InstanceId(); !hasInstId {
223 status, _, err := machine.Status()223 status, _, err := machine.Status()
224 if err != nil {224 if err != nil {
225 logger.Info("cannot get machine %q status: %v", machine, err)225 logger.Infof("cannot get machine %q status: %v", machine, err)
226 continue226 continue
227 }227 }
228 if status == params.StatusPending {228 if status == params.StatusPending {
229 pending = append(pending, machine)229 pending = append(pending, machine)
230 logger.Info("found machine %q pending provisioning", machine)230 logger.Infof("found machine %q pending provisioning", machine)
231 continue231 continue
232 }232 }
233 } else {233 } else {
234 logger.Info("machine %v already started as instance %q", machine, instId)234 logger.Infof("machine %v already started as instance %q", machine, instId)
235 }235 }
236 }236 }
237 return237 return
@@ -254,7 +254,7 @@
254 for _, i := range instances {254 for _, i := range instances {
255 unknown = append(unknown, i)255 unknown = append(unknown, i)
256 }256 }
257 logger.Trace("unknown: %v", unknown)257 logger.Tracef("unknown: %v", unknown)
258 return unknown, nil258 return unknown, nil
259}259}
260260
@@ -282,9 +282,9 @@
282 if len(instances) == 0 {282 if len(instances) == 0 {
283 return nil283 return nil
284 }284 }
285 logger.Debug("Stopping instances: %v", instances)285 logger.Debugf("Stopping instances: %v", instances)
286 if err := task.broker.StopInstances(instances); err != nil {286 if err := task.broker.StopInstances(instances); err != nil {
287 logger.Error("broker failed to stop instances: %v", err)287 logger.Errorf("broker failed to stop instances: %v", err)
288 return err288 return err
289 }289 }
290 return nil290 return nil
@@ -306,7 +306,7 @@
306 // state.Info as the PA.306 // state.Info as the PA.
307 stateInfo, apiInfo, err := task.setupAuthentication(machine)307 stateInfo, apiInfo, err := task.setupAuthentication(machine)
308 if err != nil {308 if err != nil {
309 logger.Error("failed to setup authentication: %v", err)309 logger.Errorf("failed to setup authentication: %v", err)
310 return err310 return err
311 }311 }
312 cons, err := machine.Constraints()312 cons, err := machine.Constraints()
@@ -327,10 +327,10 @@
327 // Set the state to error, so the machine will be skipped next327 // Set the state to error, so the machine will be skipped next
328 // time until the error is resolved, but don't return an328 // time until the error is resolved, but don't return an
329 // error; just keep going with the other machines.329 // error; just keep going with the other machines.
330 logger.Error("cannot start instance for machine %q: %v", machine, err)330 logger.Errorf("cannot start instance for machine %q: %v", machine, err)
331 if err1 := machine.SetStatus(params.StatusError, err.Error()); err1 != nil {331 if err1 := machine.SetStatus(params.StatusError, err.Error()); err1 != nil {
332 // Something is wrong with this machine, better report it back.332 // Something is wrong with this machine, better report it back.
333 logger.Error("cannot set error status for machine %q: %v", machine, err1)333 logger.Errorf("cannot set error status for machine %q: %v", machine, err1)
334 return err1334 return err1
335 }335 }
336 return nil336 return nil
@@ -350,7 +350,7 @@
350 // encounter surprising problems.350 // encounter surprising problems.
351 return err351 return err
352 }352 }
353 logger.Info("started machine %s as instance %s", machine, inst.Id())353 logger.Infof("started machine %s as instance %s", machine, inst.Id())
354 return nil354 return nil
355}355}
356356
357357
=== modified file 'worker/uniter/jujuc/juju-log_test.go'
--- worker/uniter/jujuc/juju-log_test.go 2013-05-30 06:54:40 +0000
+++ worker/uniter/jujuc/juju-log_test.go 2013-06-10 04:33:28 +0000
@@ -28,7 +28,7 @@
28}28}
2929
30func assertLogs(c *C, ctx jujuc.Context, badge string) {30func assertLogs(c *C, ctx jujuc.Context, badge string) {
31 loggo.ConfigureLogging("juju=DEBUG")31 loggo.ConfigureLoggers("juju=DEBUG")
32 writer := &loggo.TestWriter{}32 writer := &loggo.TestWriter{}
33 old_writer, err := loggo.ReplaceDefaultWriter(writer)33 old_writer, err := loggo.ReplaceDefaultWriter(writer)
34 c.Assert(err, IsNil)34 c.Assert(err, IsNil)

Subscribers

People subscribed via source and target branches