Signed-off-by: Ankush Agarwal <ankushagarwal11@gmail.com>
| ... | ... |
@@ -735,10 +735,7 @@ func (container *Container) startLogging() error {
|
| 735 | 735 |
return fmt.Errorf("Failed to initialize logging driver: %v", err)
|
| 736 | 736 |
} |
| 737 | 737 |
|
| 738 |
- copier, err := logger.NewCopier(container.ID, map[string]io.Reader{"stdout": container.StdoutPipe(), "stderr": container.StderrPipe()}, l)
|
|
| 739 |
- if err != nil {
|
|
| 740 |
- return err |
|
| 741 |
- } |
|
| 738 |
+ copier := logger.NewCopier(container.ID, map[string]io.Reader{"stdout": container.StdoutPipe(), "stderr": container.StderrPipe()}, l)
|
|
| 742 | 739 |
container.logCopier = copier |
| 743 | 740 |
copier.Run() |
| 744 | 741 |
container.logDriver = l |
| ... | ... |
@@ -14,7 +14,7 @@ import ( |
| 14 | 14 |
// ContainerID and Timestamp. |
| 15 | 15 |
// Writes are concurrent, so you need implement some sync in your logger |
| 16 | 16 |
type Copier struct {
|
| 17 |
- // cid is container id for which we copying logs |
|
| 17 |
+ // cid is the container id for which we are copying logs |
|
| 18 | 18 |
cid string |
| 19 | 19 |
// srcs is map of name -> reader pairs, for example "stdout", "stderr" |
| 20 | 20 |
srcs map[string]io.Reader |
| ... | ... |
@@ -22,13 +22,13 @@ type Copier struct {
|
| 22 | 22 |
copyJobs sync.WaitGroup |
| 23 | 23 |
} |
| 24 | 24 |
|
| 25 |
-// NewCopier creates new Copier |
|
| 26 |
-func NewCopier(cid string, srcs map[string]io.Reader, dst Logger) (*Copier, error) {
|
|
| 25 |
+// NewCopier creates a new Copier |
|
| 26 |
+func NewCopier(cid string, srcs map[string]io.Reader, dst Logger) *Copier {
|
|
| 27 | 27 |
return &Copier{
|
| 28 | 28 |
cid: cid, |
| 29 | 29 |
srcs: srcs, |
| 30 | 30 |
dst: dst, |
| 31 |
- }, nil |
|
| 31 |
+ } |
|
| 32 | 32 |
} |
| 33 | 33 |
|
| 34 | 34 |
// Run starts logs copying |
| ... | ... |
@@ -50,15 +50,12 @@ func TestCopier(t *testing.T) {
|
| 50 | 50 |
jsonLog := &TestLoggerJSON{Encoder: json.NewEncoder(&jsonBuf)}
|
| 51 | 51 |
|
| 52 | 52 |
cid := "a7317399f3f857173c6179d44823594f8294678dea9999662e5c625b5a1c7657" |
| 53 |
- c, err := NewCopier(cid, |
|
| 53 |
+ c := NewCopier(cid, |
|
| 54 | 54 |
map[string]io.Reader{
|
| 55 | 55 |
"stdout": &stdout, |
| 56 | 56 |
"stderr": &stderr, |
| 57 | 57 |
}, |
| 58 | 58 |
jsonLog) |
| 59 |
- if err != nil {
|
|
| 60 |
- t.Fatal(err) |
|
| 61 |
- } |
|
| 62 | 59 |
c.Run() |
| 63 | 60 |
wait := make(chan struct{})
|
| 64 | 61 |
go func() {
|