Merge lp:~thumper/juju-core/update-loggo into lp:~juju/juju-core/trunk
- update-loggo
- Merge into trunk
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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+168342@code.launchpad.net |
Commit message
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.
Tim Penhey (thumper) wrote : | # |
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
Roger Peppe (rogpeppe) wrote : | # |
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_
>
> 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:/
>
> (do not edit description out of merge proposal)
>
>
> Please review this at https:/
>
> Affected files:
> A [revision details]
> M cmd/builddb/main.go
> M cmd/juju/
> M cmd/logging.go
> M cmd/logging_test.go
> M log/log.go
> M testing/log.go
> M worker/
> M worker/
> M worker/
>
>
> 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
> - logger.
> + // Set the level on the root logger.
> + loggo.GetLogger
> }
> - loggo.Configure
> + loggo.Configure
> return nil
> }
>
>
> Index: cmd/logging_test.go
> === modified file 'cmd/logging_
> --- 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
> - c.Assert(
> + c.Assert(
> }
>
> func (s *LogSuite) TestDebugSetsLo
> @@ -56,8 +55,7 @@
> err := l.Start(ctx)
> c.Assert(err, IsNil)
>
> - logger := loggo.GetLogger
> - c.Assert(
> + c.Assert(
> }
>
> func (s *LogSuite) TestStderr(c *C) {
>
>
> Index: cmd/builddb/main.go
> === modified file 'cmd/builddb/
> --- 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.
> params.
> + logger.
Roger Peppe (rogpeppe) wrote : | # |
This CL should give some context: https:/
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:/
>
> --
> https:/
> Your team juju hackers is requested to review the proposed merge of lp:~thumper/juju-core/update-loggo into lp:juju-core.
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:/
Preview Diff
1 | === modified file 'cmd/builddb/main.go' | |||
2 | --- cmd/builddb/main.go 2013-05-29 05:29:57 +0000 | |||
3 | +++ cmd/builddb/main.go 2013-06-10 04:33:28 +0000 | |||
4 | @@ -57,13 +57,13 @@ | |||
5 | 57 | return err | 57 | return err |
6 | 58 | } | 58 | } |
7 | 59 | 59 | ||
9 | 60 | logger.Info("Waiting for unit to reach %q status...", params.StatusStarted) | 60 | logger.Infof("Waiting for unit to reach %q status...", params.StatusStarted) |
10 | 61 | unit := units[0] | 61 | unit := units[0] |
11 | 62 | last, info, err := unit.Status() | 62 | last, info, err := unit.Status() |
12 | 63 | if err != nil { | 63 | if err != nil { |
13 | 64 | return err | 64 | return err |
14 | 65 | } | 65 | } |
16 | 66 | logger.Info("Unit status is %q: %s", last, info) | 66 | logger.Infof("Unit status is %q: %s", last, info) |
17 | 67 | for last != params.StatusStarted { | 67 | for last != params.StatusStarted { |
18 | 68 | time.Sleep(2 * time.Second) | 68 | time.Sleep(2 * time.Second) |
19 | 69 | if err := unit.Refresh(); err != nil { | 69 | if err := unit.Refresh(); err != nil { |
20 | @@ -74,7 +74,7 @@ | |||
21 | 74 | return err | 74 | return err |
22 | 75 | } | 75 | } |
23 | 76 | if status != last { | 76 | if status != last { |
25 | 77 | logger.Info("Unit status is %q: %s", status, info) | 77 | logger.Infof("Unit status is %q: %s", status, info) |
26 | 78 | last = status | 78 | last = status |
27 | 79 | } | 79 | } |
28 | 80 | } | 80 | } |
29 | @@ -82,7 +82,7 @@ | |||
30 | 82 | if !ok { | 82 | if !ok { |
31 | 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") |
32 | 84 | } | 84 | } |
35 | 85 | logger.Info("Built files published at http://%s", addr) | 85 | logger.Infof("Built files published at http://%s", addr) |
36 | 86 | logger.Info("Remember to destroy the environment when you're done...") | 86 | logger.Infof("Remember to destroy the environment when you're done...") |
37 | 87 | return nil | 87 | return nil |
38 | 88 | } | 88 | } |
39 | 89 | 89 | ||
40 | === modified file 'cmd/juju/main_test.go' | |||
41 | --- cmd/juju/main_test.go 2013-06-04 21:43:25 +0000 | |||
42 | +++ cmd/juju/main_test.go 2013-06-10 04:33:28 +0000 | |||
43 | @@ -73,7 +73,7 @@ | |||
44 | 73 | } | 73 | } |
45 | 74 | 74 | ||
46 | 75 | func (s *MainSuite) TestTearDown(c *C) { | 75 | func (s *MainSuite) TestTearDown(c *C) { |
48 | 76 | loggo.ResetLogging() | 76 | loggo.ResetLoggers() |
49 | 77 | } | 77 | } |
50 | 78 | 78 | ||
51 | 79 | func (s *MainSuite) TestRunMain(c *C) { | 79 | func (s *MainSuite) TestRunMain(c *C) { |
52 | 80 | 80 | ||
53 | === modified file 'cmd/logging.go' | |||
54 | --- cmd/logging.go 2013-06-07 01:00:23 +0000 | |||
55 | +++ cmd/logging.go 2013-06-10 04:33:28 +0000 | |||
56 | @@ -57,9 +57,9 @@ | |||
57 | 57 | if l.Debug { | 57 | if l.Debug { |
58 | 58 | level = loggo.DEBUG | 58 | level = loggo.DEBUG |
59 | 59 | } | 59 | } |
62 | 60 | logger := loggo.GetLogger("juju") | 60 | // Set the level on the root logger. |
63 | 61 | logger.SetLogLevel(level) | 61 | loggo.GetLogger("").SetLogLevel(level) |
64 | 62 | } | 62 | } |
66 | 63 | loggo.ConfigureLogging(l.Config) | 63 | loggo.ConfigureLoggers(l.Config) |
67 | 64 | return nil | 64 | return nil |
68 | 65 | } | 65 | } |
69 | 66 | 66 | ||
70 | === modified file 'cmd/logging_test.go' | |||
71 | --- cmd/logging_test.go 2013-06-06 03:55:22 +0000 | |||
72 | +++ cmd/logging_test.go 2013-06-10 04:33:28 +0000 | |||
73 | @@ -46,8 +46,7 @@ | |||
74 | 46 | err := l.Start(ctx) | 46 | err := l.Start(ctx) |
75 | 47 | c.Assert(err, IsNil) | 47 | c.Assert(err, IsNil) |
76 | 48 | 48 | ||
79 | 49 | logger := loggo.GetLogger("juju") | 49 | c.Assert(loggo.GetLogger("").LogLevel(), Equals, loggo.INFO) |
78 | 50 | c.Assert(logger.GetLogLevel(), Equals, loggo.INFO) | ||
80 | 51 | } | 50 | } |
81 | 52 | 51 | ||
82 | 53 | func (s *LogSuite) TestDebugSetsLogLevel(c *C) { | 52 | func (s *LogSuite) TestDebugSetsLogLevel(c *C) { |
83 | @@ -56,8 +55,7 @@ | |||
84 | 56 | err := l.Start(ctx) | 55 | err := l.Start(ctx) |
85 | 57 | c.Assert(err, IsNil) | 56 | c.Assert(err, IsNil) |
86 | 58 | 57 | ||
89 | 59 | logger := loggo.GetLogger("juju") | 58 | c.Assert(loggo.GetLogger("").LogLevel(), Equals, loggo.DEBUG) |
88 | 60 | c.Assert(logger.GetLogLevel(), Equals, loggo.DEBUG) | ||
90 | 61 | } | 59 | } |
91 | 62 | 60 | ||
92 | 63 | func (s *LogSuite) TestStderr(c *C) { | 61 | func (s *LogSuite) TestStderr(c *C) { |
93 | 64 | 62 | ||
94 | === modified file 'log/log.go' | |||
95 | --- log/log.go 2013-05-30 06:54:40 +0000 | |||
96 | +++ log/log.go 2013-06-10 04:33:28 +0000 | |||
97 | @@ -13,31 +13,31 @@ | |||
98 | 13 | 13 | ||
99 | 14 | // Errorf logs a message using the ERROR priority. | 14 | // Errorf logs a message using the ERROR priority. |
100 | 15 | func Errorf(format string, a ...interface{}) error { | 15 | func Errorf(format string, a ...interface{}) error { |
102 | 16 | logger.Log(loggo.ERROR, format, a...) | 16 | logger.Logf(loggo.ERROR, format, a...) |
103 | 17 | return nil | 17 | return nil |
104 | 18 | } | 18 | } |
105 | 19 | 19 | ||
106 | 20 | // Warningf logs a message using the WARNING priority. | 20 | // Warningf logs a message using the WARNING priority. |
107 | 21 | func Warningf(format string, a ...interface{}) error { | 21 | func Warningf(format string, a ...interface{}) error { |
109 | 22 | logger.Log(loggo.WARNING, format, a...) | 22 | logger.Logf(loggo.WARNING, format, a...) |
110 | 23 | return nil | 23 | return nil |
111 | 24 | } | 24 | } |
112 | 25 | 25 | ||
113 | 26 | // Noticef logs a message using the NOTICE priority. | 26 | // Noticef logs a message using the NOTICE priority. |
114 | 27 | // Notice doesn't really convert to the loggo priorities... | 27 | // Notice doesn't really convert to the loggo priorities... |
115 | 28 | func Noticef(format string, a ...interface{}) error { | 28 | func Noticef(format string, a ...interface{}) error { |
117 | 29 | logger.Log(loggo.INFO, format, a...) | 29 | logger.Logf(loggo.INFO, format, a...) |
118 | 30 | return nil | 30 | return nil |
119 | 31 | } | 31 | } |
120 | 32 | 32 | ||
121 | 33 | // Infof logs a message using the INFO priority. | 33 | // Infof logs a message using the INFO priority. |
122 | 34 | func Infof(format string, a ...interface{}) error { | 34 | func Infof(format string, a ...interface{}) error { |
124 | 35 | logger.Log(loggo.INFO, format, a...) | 35 | logger.Logf(loggo.INFO, format, a...) |
125 | 36 | return nil | 36 | return nil |
126 | 37 | } | 37 | } |
127 | 38 | 38 | ||
128 | 39 | // Debugf logs a message using the DEBUG priority. | 39 | // Debugf logs a message using the DEBUG priority. |
129 | 40 | func Debugf(format string, a ...interface{}) (err error) { | 40 | func Debugf(format string, a ...interface{}) (err error) { |
131 | 41 | logger.Log(loggo.DEBUG, format, a...) | 41 | logger.Logf(loggo.DEBUG, format, a...) |
132 | 42 | return nil | 42 | return nil |
133 | 43 | } | 43 | } |
134 | 44 | 44 | ||
135 | === modified file 'testing/log.go' | |||
136 | --- testing/log.go 2013-05-31 01:40:31 +0000 | |||
137 | +++ testing/log.go 2013-06-10 04:33:28 +0000 | |||
138 | @@ -32,11 +32,11 @@ | |||
139 | 32 | func (t *LoggingSuite) SetUpTest(c *C) { | 32 | func (t *LoggingSuite) SetUpTest(c *C) { |
140 | 33 | loggo.ResetWriters() | 33 | loggo.ResetWriters() |
141 | 34 | loggo.ReplaceDefaultWriter(&gocheckWriter{c}) | 34 | loggo.ReplaceDefaultWriter(&gocheckWriter{c}) |
143 | 35 | loggo.ResetLogging() | 35 | loggo.ResetLoggers() |
144 | 36 | loggo.GetLogger("juju").SetLogLevel(loggo.DEBUG) | 36 | loggo.GetLogger("juju").SetLogLevel(loggo.DEBUG) |
145 | 37 | } | 37 | } |
146 | 38 | 38 | ||
147 | 39 | func (t *LoggingSuite) TearDownTest(c *C) { | 39 | func (t *LoggingSuite) TearDownTest(c *C) { |
149 | 40 | loggo.ResetLogging() | 40 | loggo.ResetLoggers() |
150 | 41 | loggo.ResetWriters() | 41 | loggo.ResetWriters() |
151 | 42 | } | 42 | } |
152 | 43 | 43 | ||
153 | === modified file 'worker/provisioner/provisioner.go' | |||
154 | --- worker/provisioner/provisioner.go 2013-06-10 02:52:05 +0000 | |||
155 | +++ worker/provisioner/provisioner.go 2013-06-10 04:33:28 +0000 | |||
156 | @@ -95,14 +95,14 @@ | |||
157 | 95 | return tomb.ErrDying | 95 | return tomb.ErrDying |
158 | 96 | case <-environmentProvisioner.Dying(): | 96 | case <-environmentProvisioner.Dying(): |
159 | 97 | err := environmentProvisioner.Err() | 97 | err := environmentProvisioner.Err() |
161 | 98 | logger.Error("environment provisioner died: %v", err) | 98 | logger.Errorf("environment provisioner died: %v", err) |
162 | 99 | return err | 99 | return err |
163 | 100 | case cfg, ok := <-environWatcher.Changes(): | 100 | case cfg, ok := <-environWatcher.Changes(): |
164 | 101 | if !ok { | 101 | if !ok { |
165 | 102 | return watcher.MustErr(environWatcher) | 102 | return watcher.MustErr(environWatcher) |
166 | 103 | } | 103 | } |
167 | 104 | if err := p.setConfig(cfg); err != nil { | 104 | if err := p.setConfig(cfg); err != nil { |
169 | 105 | logger.Error("loaded invalid environment configuration: %v", err) | 105 | logger.Errorf("loaded invalid environment configuration: %v", err) |
170 | 106 | } | 106 | } |
171 | 107 | } | 107 | } |
172 | 108 | } | 108 | } |
173 | 109 | 109 | ||
174 | === modified file 'worker/provisioner/provisioner_task.go' | |||
175 | --- worker/provisioner/provisioner_task.go 2013-06-10 02:51:28 +0000 | |||
176 | +++ worker/provisioner/provisioner_task.go 2013-06-10 04:33:28 +0000 | |||
177 | @@ -97,7 +97,7 @@ | |||
178 | 97 | } | 97 | } |
179 | 98 | 98 | ||
180 | 99 | func (task *provisionerTask) loop() error { | 99 | func (task *provisionerTask) loop() error { |
182 | 100 | logger.Info("Starting up provisioner task %s", task.machineId) | 100 | logger.Infof("Starting up provisioner task %s", task.machineId) |
183 | 101 | defer watcher.Stop(task.machineWatcher, &task.tomb) | 101 | defer watcher.Stop(task.machineWatcher, &task.tomb) |
184 | 102 | 102 | ||
185 | 103 | // When the watcher is started, it will have the initial changes be all | 103 | // When the watcher is started, it will have the initial changes be all |
186 | @@ -106,7 +106,7 @@ | |||
187 | 106 | for { | 106 | for { |
188 | 107 | select { | 107 | select { |
189 | 108 | case <-task.tomb.Dying(): | 108 | case <-task.tomb.Dying(): |
191 | 109 | logger.Info("Shutting down provisioner task %s", task.machineId) | 109 | logger.Infof("Shutting down provisioner task %s", task.machineId) |
192 | 110 | return tomb.ErrDying | 110 | return tomb.ErrDying |
193 | 111 | case ids, ok := <-task.machineWatcher.Changes(): | 111 | case ids, ok := <-task.machineWatcher.Changes(): |
194 | 112 | if !ok { | 112 | if !ok { |
195 | @@ -115,7 +115,7 @@ | |||
196 | 115 | // TODO(dfc; lp:1042717) fire process machines periodically to shut down unknown | 115 | // TODO(dfc; lp:1042717) fire process machines periodically to shut down unknown |
197 | 116 | // instances. | 116 | // instances. |
198 | 117 | if err := task.processMachines(ids); err != nil { | 117 | if err := task.processMachines(ids); err != nil { |
200 | 118 | logger.Error("Process machines failed: %v", err) | 118 | logger.Errorf("Process machines failed: %v", err) |
201 | 119 | return err | 119 | return err |
202 | 120 | } | 120 | } |
203 | 121 | } | 121 | } |
204 | @@ -124,7 +124,7 @@ | |||
205 | 124 | } | 124 | } |
206 | 125 | 125 | ||
207 | 126 | func (task *provisionerTask) processMachines(ids []string) error { | 126 | func (task *provisionerTask) processMachines(ids []string) error { |
209 | 127 | logger.Trace("processMachines(%v)", ids) | 127 | logger.Tracef("processMachines(%v)", ids) |
210 | 128 | // Populate the tasks maps of current instances and machines. | 128 | // Populate the tasks maps of current instances and machines. |
211 | 129 | err := task.populateMachineMaps(ids) | 129 | err := task.populateMachineMaps(ids) |
212 | 130 | if err != nil { | 130 | if err != nil { |
213 | @@ -163,7 +163,7 @@ | |||
214 | 163 | 163 | ||
215 | 164 | instances, err := task.broker.AllInstances() | 164 | instances, err := task.broker.AllInstances() |
216 | 165 | if err != nil { | 165 | if err != nil { |
218 | 166 | logger.Error("failed to get all instances from broker: %v", err) | 166 | logger.Errorf("failed to get all instances from broker: %v", err) |
219 | 167 | return err | 167 | return err |
220 | 168 | } | 168 | } |
221 | 169 | for _, i := range instances { | 169 | for _, i := range instances { |
222 | @@ -177,12 +177,12 @@ | |||
223 | 177 | machine, err := task.machineGetter.Machine(id) | 177 | machine, err := task.machineGetter.Machine(id) |
224 | 178 | switch { | 178 | switch { |
225 | 179 | case errors.IsNotFoundError(err): | 179 | case errors.IsNotFoundError(err): |
227 | 180 | logger.Debug("machine %q not found in state", id) | 180 | logger.Debugf("machine %q not found in state", id) |
228 | 181 | delete(task.machines, id) | 181 | delete(task.machines, id) |
229 | 182 | case err == nil: | 182 | case err == nil: |
230 | 183 | task.machines[id] = machine | 183 | task.machines[id] = machine |
231 | 184 | default: | 184 | default: |
233 | 185 | logger.Error("failed to get machine: %v", err) | 185 | logger.Errorf("failed to get machine: %v", err) |
234 | 186 | } | 186 | } |
235 | 187 | } | 187 | } |
236 | 188 | return nil | 188 | return nil |
237 | @@ -194,7 +194,7 @@ | |||
238 | 194 | for _, id := range ids { | 194 | for _, id := range ids { |
239 | 195 | machine, found := task.machines[id] | 195 | machine, found := task.machines[id] |
240 | 196 | if !found { | 196 | if !found { |
242 | 197 | logger.Info("machine %q not found", id) | 197 | logger.Infof("machine %q not found", id) |
243 | 198 | continue | 198 | continue |
244 | 199 | } | 199 | } |
245 | 200 | switch machine.Life() { | 200 | switch machine.Life() { |
246 | @@ -202,17 +202,17 @@ | |||
247 | 202 | if _, ok := machine.InstanceId(); ok { | 202 | if _, ok := machine.InstanceId(); ok { |
248 | 203 | continue | 203 | continue |
249 | 204 | } | 204 | } |
251 | 205 | logger.Info("killing dying, unprovisioned machine %q", machine) | 205 | logger.Infof("killing dying, unprovisioned machine %q", machine) |
252 | 206 | if err := machine.EnsureDead(); err != nil { | 206 | if err := machine.EnsureDead(); err != nil { |
254 | 207 | logger.Error("failed to ensure machine dead %q: %v", machine, err) | 207 | logger.Errorf("failed to ensure machine dead %q: %v", machine, err) |
255 | 208 | return nil, nil, err | 208 | return nil, nil, err |
256 | 209 | } | 209 | } |
257 | 210 | fallthrough | 210 | fallthrough |
258 | 211 | case state.Dead: | 211 | case state.Dead: |
259 | 212 | dead = append(dead, machine) | 212 | dead = append(dead, machine) |
261 | 213 | logger.Info("removing dead machine %q", machine) | 213 | logger.Infof("removing dead machine %q", machine) |
262 | 214 | if err := machine.Remove(); err != nil { | 214 | if err := machine.Remove(); err != nil { |
264 | 215 | logger.Error("failed to remove dead machine %q", machine) | 215 | logger.Errorf("failed to remove dead machine %q", machine) |
265 | 216 | return nil, nil, err | 216 | return nil, nil, err |
266 | 217 | } | 217 | } |
267 | 218 | // now remove it from the machines map | 218 | // now remove it from the machines map |
268 | @@ -222,16 +222,16 @@ | |||
269 | 222 | if instId, hasInstId := machine.InstanceId(); !hasInstId { | 222 | if instId, hasInstId := machine.InstanceId(); !hasInstId { |
270 | 223 | status, _, err := machine.Status() | 223 | status, _, err := machine.Status() |
271 | 224 | if err != nil { | 224 | if err != nil { |
273 | 225 | logger.Info("cannot get machine %q status: %v", machine, err) | 225 | logger.Infof("cannot get machine %q status: %v", machine, err) |
274 | 226 | continue | 226 | continue |
275 | 227 | } | 227 | } |
276 | 228 | if status == params.StatusPending { | 228 | if status == params.StatusPending { |
277 | 229 | pending = append(pending, machine) | 229 | pending = append(pending, machine) |
279 | 230 | logger.Info("found machine %q pending provisioning", machine) | 230 | logger.Infof("found machine %q pending provisioning", machine) |
280 | 231 | continue | 231 | continue |
281 | 232 | } | 232 | } |
282 | 233 | } else { | 233 | } else { |
284 | 234 | logger.Info("machine %v already started as instance %q", machine, instId) | 234 | logger.Infof("machine %v already started as instance %q", machine, instId) |
285 | 235 | } | 235 | } |
286 | 236 | } | 236 | } |
287 | 237 | return | 237 | return |
288 | @@ -254,7 +254,7 @@ | |||
289 | 254 | for _, i := range instances { | 254 | for _, i := range instances { |
290 | 255 | unknown = append(unknown, i) | 255 | unknown = append(unknown, i) |
291 | 256 | } | 256 | } |
293 | 257 | logger.Trace("unknown: %v", unknown) | 257 | logger.Tracef("unknown: %v", unknown) |
294 | 258 | return unknown, nil | 258 | return unknown, nil |
295 | 259 | } | 259 | } |
296 | 260 | 260 | ||
297 | @@ -282,9 +282,9 @@ | |||
298 | 282 | if len(instances) == 0 { | 282 | if len(instances) == 0 { |
299 | 283 | return nil | 283 | return nil |
300 | 284 | } | 284 | } |
302 | 285 | logger.Debug("Stopping instances: %v", instances) | 285 | logger.Debugf("Stopping instances: %v", instances) |
303 | 286 | if err := task.broker.StopInstances(instances); err != nil { | 286 | if err := task.broker.StopInstances(instances); err != nil { |
305 | 287 | logger.Error("broker failed to stop instances: %v", err) | 287 | logger.Errorf("broker failed to stop instances: %v", err) |
306 | 288 | return err | 288 | return err |
307 | 289 | } | 289 | } |
308 | 290 | return nil | 290 | return nil |
309 | @@ -306,7 +306,7 @@ | |||
310 | 306 | // state.Info as the PA. | 306 | // state.Info as the PA. |
311 | 307 | stateInfo, apiInfo, err := task.setupAuthentication(machine) | 307 | stateInfo, apiInfo, err := task.setupAuthentication(machine) |
312 | 308 | if err != nil { | 308 | if err != nil { |
314 | 309 | logger.Error("failed to setup authentication: %v", err) | 309 | logger.Errorf("failed to setup authentication: %v", err) |
315 | 310 | return err | 310 | return err |
316 | 311 | } | 311 | } |
317 | 312 | cons, err := machine.Constraints() | 312 | cons, err := machine.Constraints() |
318 | @@ -327,10 +327,10 @@ | |||
319 | 327 | // Set the state to error, so the machine will be skipped next | 327 | // Set the state to error, so the machine will be skipped next |
320 | 328 | // time until the error is resolved, but don't return an | 328 | // time until the error is resolved, but don't return an |
321 | 329 | // error; just keep going with the other machines. | 329 | // error; just keep going with the other machines. |
323 | 330 | logger.Error("cannot start instance for machine %q: %v", machine, err) | 330 | logger.Errorf("cannot start instance for machine %q: %v", machine, err) |
324 | 331 | if err1 := machine.SetStatus(params.StatusError, err.Error()); err1 != nil { | 331 | if err1 := machine.SetStatus(params.StatusError, err.Error()); err1 != nil { |
325 | 332 | // Something is wrong with this machine, better report it back. | 332 | // Something is wrong with this machine, better report it back. |
327 | 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) |
328 | 334 | return err1 | 334 | return err1 |
329 | 335 | } | 335 | } |
330 | 336 | return nil | 336 | return nil |
331 | @@ -350,7 +350,7 @@ | |||
332 | 350 | // encounter surprising problems. | 350 | // encounter surprising problems. |
333 | 351 | return err | 351 | return err |
334 | 352 | } | 352 | } |
336 | 353 | logger.Info("started machine %s as instance %s", machine, inst.Id()) | 353 | logger.Infof("started machine %s as instance %s", machine, inst.Id()) |
337 | 354 | return nil | 354 | return nil |
338 | 355 | } | 355 | } |
339 | 356 | 356 | ||
340 | 357 | 357 | ||
341 | === modified file 'worker/uniter/jujuc/juju-log_test.go' | |||
342 | --- worker/uniter/jujuc/juju-log_test.go 2013-05-30 06:54:40 +0000 | |||
343 | +++ worker/uniter/jujuc/juju-log_test.go 2013-06-10 04:33:28 +0000 | |||
344 | @@ -28,7 +28,7 @@ | |||
345 | 28 | } | 28 | } |
346 | 29 | 29 | ||
347 | 30 | func assertLogs(c *C, ctx jujuc.Context, badge string) { | 30 | func assertLogs(c *C, ctx jujuc.Context, badge string) { |
349 | 31 | loggo.ConfigureLogging("juju=DEBUG") | 31 | loggo.ConfigureLoggers("juju=DEBUG") |
350 | 32 | writer := &loggo.TestWriter{} | 32 | writer := &loggo.TestWriter{} |
351 | 33 | old_writer, err := loggo.ReplaceDefaultWriter(writer) | 33 | old_writer, err := loggo.ReplaceDefaultWriter(writer) |
352 | 34 | c.Assert(err, IsNil) | 34 | c.Assert(err, IsNil) |
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: main_test. go provisioner/ provisioner. go provisioner/ provisioner_ task.go uniter/ jujuc/juju- log_test. go
A [revision details]
M cmd/builddb/main.go
M cmd/juju/
M cmd/logging.go
M cmd/logging_test.go
M log/log.go
M testing/log.go
M worker/
M worker/
M worker/
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 ("juju" ) SetLogLevel( level) ("").SetLogLeve l(level) Logging( l.Config) Loggers( l.Config)
=== 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
- logger.
+ // Set the level on the root logger.
+ loggo.GetLogger
}
- loggo.Configure
+ loggo.Configure
return nil
}
Index: cmd/logging_test.go test.go'
=== modified file 'cmd/logging_
--- 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" ) logger. GetLogLevel( ), Equals, loggo.INFO) loggo.GetLogger ("").LogLevel( ), Equals, loggo.INFO)
- c.Assert(
+ c.Assert(
}
func (s *LogSuite) TestDebugSetsLo gLevel( c *C) {
@@ -56,8 +55,7 @@
err := l.Start(ctx)
c.Assert(err, IsNil)
- logger := loggo.GetLogger ("juju" ) logger. GetLogLevel( ), Equals, loggo.DEBUG) loggo.GetLogger ("").LogLevel( ), Equals, loggo.DEBUG)
- c.Assert(
+ c.Assert(
}
func (s *LogSuite) TestStderr(c *C) {
Index: cmd/builddb/main.go main.go'
=== modified file 'cmd/builddb/
--- 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...", StatusStarted) Infof(" Waiting for unit to reach %q status...", StatusStarted) StatusStarted {
params.
+ logger.
params.
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.
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...