aboutsummaryrefslogtreecommitdiff
path: root/go/glog
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2013-08-08 23:57:22 -0700
committerChris Lu <chris.lu@gmail.com>2013-08-08 23:57:22 -0700
commited154053c833f9bcce9094e535e2adc0a0397e46 (patch)
tree40dc16b76a12929bc8ac7af0549ccf65316e9011 /go/glog
parentb27947b3550dfdf091010bd2607b8c36a5dca049 (diff)
downloadseaweedfs-ed154053c833f9bcce9094e535e2adc0a0397e46.tar.xz
seaweedfs-ed154053c833f9bcce9094e535e2adc0a0397e46.zip
switching to temporarily use glog library
Diffstat (limited to 'go/glog')
-rw-r--r--go/glog/convenient_api.go17
-rw-r--r--go/glog/glog.go6
-rw-r--r--go/glog/glog_file.go2
3 files changed, 21 insertions, 4 deletions
diff --git a/go/glog/convenient_api.go b/go/glog/convenient_api.go
new file mode 100644
index 000000000..b209c0b5c
--- /dev/null
+++ b/go/glog/convenient_api.go
@@ -0,0 +1,17 @@
+package glog
+
+import ()
+
+/*
+Copying the original glog because it is missing several convenient methods.
+1. change log file size limit to 180MB
+2. use ToStderrAndLog() in the weed.go
+3. remove nano time in log format
+*/
+
+func ToStderr() {
+ logging.toStderr = true
+}
+func ToStderrAndLog() {
+ logging.alsoToStderr = true
+}
diff --git a/go/glog/glog.go b/go/glog/glog.go
index 59478c5ec..28af70191 100644
--- a/go/glog/glog.go
+++ b/go/glog/glog.go
@@ -557,8 +557,8 @@ func (l *loggingT) header(s severity) *buffer {
buf.twoDigits(9, minute)
buf.tmp[11] = ':'
buf.twoDigits(12, second)
- buf.tmp[14] = '.'
- buf.nDigits(6, 15, now.Nanosecond()/1000)
+ //buf.tmp[14] = '.'
+ //buf.nDigits(6, 15, now.Nanosecond()/1000)
buf.tmp[21] = ' '
buf.nDigits(5, 22, pid) // TODO: should be TID
buf.tmp[27] = ' '
@@ -798,7 +798,7 @@ func (sb *syncBuffer) rotateFile(now time.Time) error {
fmt.Fprintf(&buf, "Log file created at: %s\n", now.Format("2006/01/02 15:04:05"))
fmt.Fprintf(&buf, "Running on machine: %s\n", host)
fmt.Fprintf(&buf, "Binary: Built with %s %s for %s/%s\n", runtime.Compiler, runtime.Version(), runtime.GOOS, runtime.GOARCH)
- fmt.Fprintf(&buf, "Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg\n")
+ fmt.Fprintf(&buf, "Log line format: [IWEF]mmdd hh:mm:ss threadid file:line] msg\n")
n, err := sb.file.Write(buf.Bytes())
sb.nbytes += uint64(n)
return err
diff --git a/go/glog/glog_file.go b/go/glog/glog_file.go
index 8dcb2bc08..8c744bc51 100644
--- a/go/glog/glog_file.go
+++ b/go/glog/glog_file.go
@@ -31,7 +31,7 @@ import (
)
// MaxSize is the maximum size of a log file in bytes.
-var MaxSize uint64 = 1024 * 1024 * 1800
+var MaxSize uint64 = 1024 * 1024 * 180
// logDirs lists the candidate directories for new log files.
var logDirs []string