Hello community,
here is the log from the commit of package golang-googlecode-log4go for
openSUSE:Factory checked in at 2016-01-07 00:24:34
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/golang-googlecode-log4go (Old)
and /work/SRC/openSUSE:Factory/.golang-googlecode-log4go.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "golang-googlecode-log4go"
Changes:
--------
---
/work/SRC/openSUSE:Factory/golang-googlecode-log4go/golang-googlecode-log4go.changes
2015-07-24 09:58:56.000000000 +0200
+++
/work/SRC/openSUSE:Factory/.golang-googlecode-log4go.new/golang-googlecode-log4go.changes
2016-01-07 00:24:35.000000000 +0100
@@ -1,0 +2,10 @@
+Sat Jan 02 12:49:38 UTC 2016 - [email protected]
+
+- Update to version 3.0.1+git20151210.8e9057c:
+ + add %s short version of %S format
+ + add format support for termlog
+ + Console example should include Close method, otherwise you will not find
the output when you run this sample
+ + support max backup files
+ + ConsoleLogWriter receiver should be a pointer
+
+-------------------------------------------------------------------
Old:
----
log4go-3.0.1+git20150716.5c3c713.tar.xz
New:
----
_servicedata
log4go-3.0.1+git20151210.8e9057c.tar.xz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ golang-googlecode-log4go.spec ++++++
--- /var/tmp/diff_new_pack.aijmN3/_old 2016-01-07 00:24:37.000000000 +0100
+++ /var/tmp/diff_new_pack.aijmN3/_new 2016-01-07 00:24:37.000000000 +0100
@@ -1,7 +1,7 @@
#
# spec file for package golang-googlecode-log4go
#
-# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,11 +17,11 @@
Name: golang-googlecode-log4go
-Version: 3.0.1+git20150716.5c3c713
+Version: 3.0.1+git20151210.8e9057c
Release: 0
Summary: A replacement logging package for Go language
License: BSD-2-Clause
-Group: Development/Languages/Other
+Group: Development/Languages/Golang
Url: https://github.com/alecthomas/log4go
Source: log4go-%{version}.tar.xz
#PATCH-FIX-UPSTREAM fix some errors in examples
@@ -64,12 +64,22 @@
%build
%goprep code.google.com/p/log4go
-%gobuild
+%gobuild ...
%install
%goinstall
%gosrc
+# remove stuff built from examples
+rm -rf %{buildroot}%{_bindir}
+rm -rf %{buildroot}%{_prefix}/lib/debug
+%if "%{_lib}" == "lib64"
+rm -rf %{buildroot}%{_prefix}/lib
+%endif
+
+%check
+%gotest code.google.com/p/log4go
+
%files
%defattr(-,root,root,-)
%doc README LICENSE examples/*
++++++ _service ++++++
--- /var/tmp/diff_new_pack.aijmN3/_old 2016-01-07 00:24:37.000000000 +0100
+++ /var/tmp/diff_new_pack.aijmN3/_new 2016-01-07 00:24:37.000000000 +0100
@@ -1,16 +1,17 @@
<services>
- <service name="tar_scm" mode="localonly">
+ <service name="tar_scm" mode="disabled">
<param name="url">https://github.com/alecthomas/log4go.git</param>
<param name="scm">git</param>
<param name="exclude">.git</param>
<param name="versionformat">3.0.1+git%cd.%h</param>
<param name="revision">master</param>
+ <param name="changesgenerate">enable</param>
</service>
- <service name="recompress" mode="localonly">
+ <service name="recompress" mode="disabled">
<param name="file">log4go-*.tar</param>
<param name="compression">xz</param>
</service>
- <service name="set_version" mode="localonly">
+ <service name="set_version" mode="disabled">
<param name="basename">log4go</param>
</service>
</services>
++++++ _servicedata ++++++
<servicedata>
<service name="tar_scm">
<param name="url">https://github.com/alecthomas/log4go.git</param>
<param
name="changesrevision">8e9057c3b25c409a34c0b9737cdc82cbcafeabce</param></service></servicedata>++++++
log4go-3.0.1+git20150716.5c3c713.tar.xz ->
log4go-3.0.1+git20151210.8e9057c.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/log4go-3.0.1+git20150716.5c3c713/filelog.go
new/log4go-3.0.1+git20151210.8e9057c/filelog.go
--- old/log4go-3.0.1+git20150716.5c3c713/filelog.go 2015-07-23
11:32:25.000000000 +0200
+++ new/log4go-3.0.1+git20151210.8e9057c/filelog.go 2016-01-02
13:44:07.000000000 +0100
@@ -36,7 +36,8 @@
daily_opendate int
// Keep old logfiles (.001, .002, etc)
- rotate bool
+ rotate bool
+ maxbackup int
}
// This is the FileLogWriter's output method
@@ -60,11 +61,12 @@
// [%D %T] [%L] (%S) %M
func NewFileLogWriter(fname string, rotate bool) *FileLogWriter {
w := &FileLogWriter{
- rec: make(chan *LogRecord, LogBufferLength),
- rot: make(chan bool),
- filename: fname,
- format: "[%D %T] [%L] (%S) %M",
- rotate: rotate,
+ rec: make(chan *LogRecord, LogBufferLength),
+ rot: make(chan bool),
+ filename: fname,
+ format: "[%D %T] [%L] (%S) %M",
+ rotate: rotate,
+ maxbackup: 999,
}
// open the file for the first time
@@ -141,20 +143,27 @@
fname := ""
if w.daily && time.Now().Day() != w.daily_opendate {
yesterday := time.Now().AddDate(0, 0,
-1).Format("2006-01-02")
+
for ; err == nil && num <= 999; num++ {
fname = w.filename +
fmt.Sprintf(".%s.%03d", yesterday, num)
_, err = os.Lstat(fname)
}
+ // return error if the last file checked still
existed
+ if err == nil {
+ return fmt.Errorf("Rotate: Cannot find
free log number to rename %s\n", w.filename)
+ }
} else {
- for ; err == nil && num <= 999; num++ {
- fname = w.filename +
fmt.Sprintf(".%s.%03d", time.Now().Format("2006-01-02"), num)
+ num = w.maxbackup - 1
+ for ; num >= 1; num-- {
+ fname = w.filename + fmt.Sprintf(".%d",
num)
+ nfname := w.filename +
fmt.Sprintf(".%d", num+1)
_, err = os.Lstat(fname)
+ if err == nil {
+ os.Rename(fname, nfname)
+ }
}
}
- // return error if the last file checked still existed
- if err == nil {
- return fmt.Errorf("Rotate: Cannot find free log
number to rename %s\n", w.filename)
- }
+
w.file.Close()
// Rename the file to its newfound home
err = os.Rename(w.filename, fname)
@@ -226,6 +235,13 @@
return w
}
+// Set max backup files. Must be called before the first log message
+// is written.
+func (w *FileLogWriter) SetRotateMaxBackup(maxbackup int) *FileLogWriter {
+ w.maxbackup = maxbackup
+ return w
+}
+
// SetRotate changes whether or not the old logs are kept. (chainable) Must be
// called before the first log message is written. If rotate is false, the
// files are overwritten; otherwise, they are rotated to another file before
the
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/log4go-3.0.1+git20150716.5c3c713/termlog.go
new/log4go-3.0.1+git20151210.8e9057c/termlog.go
--- old/log4go-3.0.1+git20150716.5c3c713/termlog.go 2015-07-23
11:32:25.000000000 +0200
+++ new/log4go-3.0.1+git20151210.8e9057c/termlog.go 2016-01-02
13:44:07.000000000 +0100
@@ -29,7 +29,7 @@
func (c *ConsoleLogWriter) SetFormat(format string) {
c.format = format
}
-func (c ConsoleLogWriter) run(out io.Writer) {
+func (c *ConsoleLogWriter) run(out io.Writer) {
for rec := range c.w {
fmt.Fprint(out, FormatLogRecord(c.format, rec))
}
@@ -37,13 +37,13 @@
// This is the ConsoleLogWriter's output method. This will block if the output
// buffer is full.
-func (c ConsoleLogWriter) LogWrite(rec *LogRecord) {
+func (c *ConsoleLogWriter) LogWrite(rec *LogRecord) {
c.w <- rec
}
// Close stops the logger from sending messages to standard output. Attempts
to
// send log messages to this logger after a Close have undefined behavior.
-func (c ConsoleLogWriter) Close() {
+func (c *ConsoleLogWriter) Close() {
close(c.w)
time.Sleep(50 * time.Millisecond) // Try to give console I/O time to
complete
}