LEFT | RIGHT |
1 package jujuc | 1 package jujuc |
2 | 2 |
3 import ( | 3 import ( |
4 "errors" | 4 "errors" |
5 "launchpad.net/gnuflag" | 5 "launchpad.net/gnuflag" |
6 "launchpad.net/juju-core/cmd" | 6 "launchpad.net/juju-core/cmd" |
7 "launchpad.net/juju-core/log" | 7 "launchpad.net/juju-core/log" |
8 "strings" | 8 "strings" |
9 ) | 9 ) |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 args = f.Args() | 33 args = f.Args() |
34 if args == nil { | 34 if args == nil { |
35 return errors.New("no message specified") | 35 return errors.New("no message specified") |
36 } | 36 } |
37 c.Message = strings.Join(args, " ") | 37 c.Message = strings.Join(args, " ") |
38 return nil | 38 return nil |
39 } | 39 } |
40 | 40 |
41 func (c *JujuLogCommand) Run(_ *cmd.Context) error { | 41 func (c *JujuLogCommand) Run(_ *cmd.Context) error { |
42 badge := c.ctx.UnitName() | 42 badge := c.ctx.UnitName() |
43 » if c.ctx.HasHookRelation() { | 43 » if r, found := c.ctx.HookRelation(); found { |
44 » » badge = badge + " " + c.ctx.HookRelation().FakeId() | 44 » » badge = badge + " " + r.FakeId() |
45 } | 45 } |
46 msg := badge + ": " + c.Message | 46 msg := badge + ": " + c.Message |
47 if c.Debug { | 47 if c.Debug { |
48 log.Debugf("%s", msg) | 48 log.Debugf("%s", msg) |
49 } else { | 49 } else { |
50 log.Printf("%s", msg) | 50 log.Printf("%s", msg) |
51 } | 51 } |
52 return nil | 52 return nil |
53 } | 53 } |
LEFT | RIGHT |