@cryptotaxi247 / kubo / commits / eacaa2d73

Revert "use forked lumberjack (buffers writes)"

This reverts commit 7055d769582dc852d72c04fab044ca8deb9b3a89.

Henry committed Apr 30, 2015 at 13:30 UTC eacaa2d739b5deca3a67eafb65e028b35a002f1d
13 files changed +7 -33
Godeps/Godeps.json
+5 -5
@@ -262,16 +262,16 @@
262 "ImportPath": "golang.org/x/net/context",
263 "Rev": "ff8eb9a34a5cbb9941ffc6f84a19a8014c2646ad"
264 },
265 - {
266 - "ImportPath": "gopkg.in/cryptix/lumberjack.v2",
267 - "Comment": "v1.0-13-gb9ca6a4",
268 - "Rev": "b9ca6a494a971c67b412b38c88ccdbc096d1c9af"
269 - },
265 {
266 "ImportPath": "gopkg.in/fsnotify.v1",
267 "Comment": "v1.2.0",
268 "Rev": "96c060f6a6b7e0d6f75fddd10efeaca3e5d1bcb0"
269 },
270 + {
271 + "ImportPath": "gopkg.in/natefinch/lumberjack.v2",
272 + "Comment": "v1.0-12-gd28785c",
273 + "Rev": "d28785c2f27cd682d872df46ccd8232843629f54"
274 + },
275 {
276 "ImportPath": "gopkg.in/tomb.v1",
277 "Rev": "dd632973f1e7218eb1089048e0798ec9ae7dceb8"
Godeps/_workspace/src/gopkg.in/natefinch/lumberjack.v2/.gitignore renamed
Godeps/_workspace/src/gopkg.in/natefinch/lumberjack.v2/LICENSE renamed
Godeps/_workspace/src/gopkg.in/natefinch/lumberjack.v2/README.md renamed
Godeps/_workspace/src/gopkg.in/natefinch/lumberjack.v2/chown.go renamed
Godeps/_workspace/src/gopkg.in/natefinch/lumberjack.v2/chown_linux.go renamed
Godeps/_workspace/src/gopkg.in/natefinch/lumberjack.v2/example_test.go renamed
Godeps/_workspace/src/gopkg.in/natefinch/lumberjack.v2/linux_test.go renamed
Godeps/_workspace/src/gopkg.in/natefinch/lumberjack.v2/lumberjack.go renamed
+1 -10
@@ -22,7 +22,6 @@
22 package lumberjack
23
24 import (
25 - "bufio"
25 "fmt"
26 "io"
27 "io/ioutil"
@@ -95,7 +94,6 @@ type Logger struct {
94
95 size int64
96 file *os.File
98 - bw *bufio.Writer
97 mu sync.Mutex
98 }
99
@@ -139,7 +137,7 @@ func (l *Logger) Write(p []byte) (n int, err error) {
137 }
138 }
139
142 - n, err = l.bw.Write(p)
140 + n, err = l.file.Write(p)
141 l.size += int64(n)
142
143 return n, err
@@ -157,11 +155,6 @@ func (l *Logger) close() error {
155 if l.file == nil {
156 return nil
157 }
160 -
161 - if err := l.bw.Flush(); err != nil {
162 - return err
163 - }
164 -
158 err := l.file.Close()
159 l.file = nil
160 return err
@@ -226,7 +219,6 @@ func (l *Logger) openNew() error {
219 return fmt.Errorf("can't open new logfile: %s", err)
220 }
221 l.file = f
229 - l.bw = bufio.NewWriter(l.file)
222 l.size = 0
223 return nil
224 }
@@ -266,7 +258,6 @@ func (l *Logger) openExistingOrNew(writeLen int) error {
258 file, err := os.OpenFile(filename, os.O_APPEND|os.O_WRONLY, 0644)
259 if err == nil {
260 l.file = file
269 - l.bw = bufio.NewWriter(l.file)
261 l.size = info.Size()
262 return nil
263 }
Godeps/_workspace/src/gopkg.in/natefinch/lumberjack.v2/lumberjack_test.go renamed
-17
@@ -41,7 +41,6 @@ func TestNewFile(t *testing.T) {
41 n, err := l.Write(b)
42 isNil(err, t)
43 equals(len(b), n, t)
44 - isNil(l.bw.Flush(), t)
44 existsWithLen(logFile(dir), n, t)
45 fileCount(dir, 1, t)
46 }
@@ -66,7 +65,6 @@ func TestOpenExisting(t *testing.T) {
65 isNil(err, t)
66 equals(len(b), n, t)
67
69 - isNil(l.bw.Flush(), t)
68 // make sure the file got appended
69 existsWithLen(filename, len(data)+n, t)
70
@@ -108,7 +106,6 @@ func TestMakeLogDir(t *testing.T) {
106 n, err := l.Write(b)
107 isNil(err, t)
108 equals(len(b), n, t)
111 - isNil(l.bw.Flush(), t)
109 existsWithLen(logFile(dir), n, t)
110 fileCount(dir, 1, t)
111 }
@@ -125,7 +122,6 @@ func TestDefaultFilename(t *testing.T) {
122
123 isNil(err, t)
124 equals(len(b), n, t)
128 - isNil(l.bw.Flush(), t)
125 existsWithLen(filename, n, t)
126 }
127
@@ -146,7 +142,6 @@ func TestAutoRotate(t *testing.T) {
142 n, err := l.Write(b)
143 isNil(err, t)
144 equals(len(b), n, t)
149 - isNil(l.bw.Flush(), t)
145
146 existsWithLen(filename, n, t)
147 fileCount(dir, 1, t)
@@ -157,7 +152,6 @@ func TestAutoRotate(t *testing.T) {
152 n, err = l.Write(b2)
153 isNil(err, t)
154 equals(len(b2), n, t)
160 - isNil(l.bw.Flush(), t)
155
156 // the old logfile should be moved aside and the main logfile should have
157 // only the last write in it.
@@ -193,7 +187,6 @@ func TestFirstWriteRotate(t *testing.T) {
187 n, err := l.Write(b)
188 isNil(err, t)
189 equals(len(b), n, t)
196 - isNil(l.bw.Flush(), t)
190
191 existsWithLen(filename, n, t)
192 existsWithLen(backupFile(dir), len(start), t)
@@ -218,7 +211,6 @@ func TestMaxBackups(t *testing.T) {
211 n, err := l.Write(b)
212 isNil(err, t)
213 equals(len(b), n, t)
221 - isNil(l.bw.Flush(), t)
214
215 existsWithLen(filename, n, t)
216 fileCount(dir, 1, t)
@@ -230,7 +222,6 @@ func TestMaxBackups(t *testing.T) {
222 n, err = l.Write(b2)
223 isNil(err, t)
224 equals(len(b2), n, t)
233 - isNil(l.bw.Flush(), t)
225
226 // this will use the new fake time
227 secondFilename := backupFile(dir)
@@ -247,7 +238,6 @@ func TestMaxBackups(t *testing.T) {
238 n, err = l.Write(b2)
239 isNil(err, t)
240 equals(len(b2), n, t)
250 - isNil(l.bw.Flush(), t)
241
242 // this will use the new fake time
243 thirdFilename := backupFile(dir)
@@ -290,7 +280,6 @@ func TestMaxBackups(t *testing.T) {
280 n, err = l.Write(b2)
281 isNil(err, t)
282 equals(len(b2), n, t)
293 - isNil(l.bw.Flush(), t)
283
284 // this will use the new fake time
285 fourthFilename := backupFile(dir)
@@ -337,7 +326,6 @@ func TestMaxAge(t *testing.T) {
326 n, err := l.Write(b)
327 isNil(err, t)
328 equals(len(b), n, t)
340 - isNil(l.bw.Flush(), t)
329
330 existsWithLen(filename, n, t)
331 fileCount(dir, 1, t)
@@ -349,7 +337,6 @@ func TestMaxAge(t *testing.T) {
337 n, err = l.Write(b2)
338 isNil(err, t)
339 equals(len(b2), n, t)
352 - isNil(l.bw.Flush(), t)
340 existsWithLen(backupFile(dir), len(b), t)
341
342 // we need to wait a little bit since the files get deleted on a different
@@ -372,7 +359,6 @@ func TestMaxAge(t *testing.T) {
359 n, err = l.Write(b2)
360 isNil(err, t)
361 equals(len(b3), n, t)
375 - isNil(l.bw.Flush(), t)
362 existsWithLen(backupFile(dir), len(b2), t)
363
364 // we need to wait a little bit since the files get deleted on a different
@@ -468,7 +454,6 @@ func TestLocalTime(t *testing.T) {
454 n2, err := l.Write(b2)
455 isNil(err, t)
456 equals(len(b2), n2, t)
471 - isNil(l.bw.Flush(), t)
457
458 existsWithLen(logFile(dir), n2, t)
459 existsWithLen(backupFileLocal(dir), n, t)
@@ -491,7 +476,6 @@ func TestRotate(t *testing.T) {
476 n, err := l.Write(b)
477 isNil(err, t)
478 equals(len(b), n, t)
494 - isNil(l.bw.Flush(), t)
479
480 existsWithLen(filename, n, t)
481 fileCount(dir, 1, t)
@@ -527,7 +511,6 @@ func TestRotate(t *testing.T) {
511 n, err = l.Write(b2)
512 isNil(err, t)
513 equals(len(b2), n, t)
530 - isNil(l.Close(), t)
514
515 // this will use the new fake time
516 existsWithLen(filename, n, t)
Godeps/_workspace/src/gopkg.in/natefinch/lumberjack.v2/rotate_test.go renamed
Godeps/_workspace/src/gopkg.in/natefinch/lumberjack.v2/testing_test.go renamed
thirdparty/eventlog/option.go
+1 -1
@@ -5,7 +5,7 @@ import (
5 "os"
6
7 "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/Sirupsen/logrus"
8 - "github.com/ipfs/go-ipfs/Godeps/_workspace/src/gopkg.in/cryptix/lumberjack.v2"
8 + "github.com/ipfs/go-ipfs/Godeps/_workspace/src/gopkg.in/natefinch/lumberjack.v2"
9 )
10
11 // init sets up sane defaults