mirror of
https://github.com/go-gitea/gitea.git
synced 2024-08-18 18:43:26 +02:00
* Panic don't fatal on create new logger Fixes #5854 Signed-off-by: Andrew Thornton <art27@cantab.net> * partial broken * Update the logging infrastrcture Signed-off-by: Andrew Thornton <art27@cantab.net> * Reset the skip levels for Fatal and Error Signed-off-by: Andrew Thornton <art27@cantab.net> * broken ncsa * More log.Error fixes Signed-off-by: Andrew Thornton <art27@cantab.net> * Remove nal * set log-levels to lowercase * Make console_test test all levels * switch to lowercased levels * OK now working * Fix vetting issues * Fix lint * Fix tests * change default logging to match current gitea * Improve log testing Signed-off-by: Andrew Thornton <art27@cantab.net> * reset error skip levels to 0 * Update documentation and access logger configuration * Redirect the router log back to gitea if redirect macaron log but also allow setting the log level - i.e. TRACE * Fix broken level caching * Refactor the router log * Add Router logger * Add colorizing options * Adjust router colors * Only create logger if they will be used * update app.ini.sample * rename Attribute ColorAttribute * Change from white to green for function * Set fatal/error levels * Restore initial trace logger * Fix Trace arguments in modules/auth/auth.go * Properly handle XORMLogger * Improve admin/config page * fix fmt * Add auto-compression of old logs * Update error log levels * Remove the unnecessary skip argument from Error, Fatal and Critical * Add stacktrace support * Fix tests * Remove x/sync from vendors? * Add stderr option to console logger * Use filepath.ToSlash to protect against Windows in tests * Remove prefixed underscores from names in colors.go * Remove not implemented database logger This was removed from Gogs on 4 Mar 2016 but left in the configuration since then. * Ensure that log paths are relative to ROOT_PATH * use path.Join * rename jsonConfig to logConfig * Rename "config" to "jsonConfig" to make it clearer * Requested changes * Requested changes: XormLogger * Try to color the windows terminal If successful default to colorizing the console logs * fixup * Colorize initially too * update vendor * Colorize logs on default and remove if this is not a colorizing logger * Fix documentation * fix test * Use go-isatty to detect if on windows we are on msys or cygwin * Fix spelling mistake * Add missing vendors * More changes * Rationalise the ANSI writer protection * Adjust colors on advice from @0x5c * Make Flags a comma separated list * Move to use the windows constant for ENABLE_VIRTUAL_TERMINAL_PROCESSING * Ensure matching is done on the non-colored message - to simpify EXPRESSION
148 lines
5.2 KiB
Go
148 lines
5.2 KiB
Go
// Copyright 2009 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// +build sparc64,linux
|
|
|
|
package unix
|
|
|
|
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
|
|
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
|
|
//sys Dup2(oldfd int, newfd int) (err error)
|
|
//sys Fchown(fd int, uid int, gid int) (err error)
|
|
//sys Fstat(fd int, stat *Stat_t) (err error)
|
|
//sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64
|
|
//sys Fstatfs(fd int, buf *Statfs_t) (err error)
|
|
//sys Ftruncate(fd int, length int64) (err error)
|
|
//sysnb Getegid() (egid int)
|
|
//sysnb Geteuid() (euid int)
|
|
//sysnb Getgid() (gid int)
|
|
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
|
|
//sysnb Getuid() (uid int)
|
|
//sysnb InotifyInit() (fd int, err error)
|
|
//sys Lchown(path string, uid int, gid int) (err error)
|
|
//sys Listen(s int, n int) (err error)
|
|
//sys Lstat(path string, stat *Stat_t) (err error)
|
|
//sys Pause() (err error)
|
|
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
|
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
|
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
|
|
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
|
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
|
|
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
|
//sys Setfsgid(gid int) (err error)
|
|
//sys Setfsuid(uid int) (err error)
|
|
//sysnb Setregid(rgid int, egid int) (err error)
|
|
//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
|
|
//sysnb Setresuid(ruid int, euid int, suid int) (err error)
|
|
//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
|
|
//sysnb Setreuid(ruid int, euid int) (err error)
|
|
//sys Shutdown(fd int, how int) (err error)
|
|
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
|
|
//sys Stat(path string, stat *Stat_t) (err error)
|
|
//sys Statfs(path string, buf *Statfs_t) (err error)
|
|
//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
|
|
//sys Truncate(path string, length int64) (err error)
|
|
//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
|
|
//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
|
|
//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
|
|
//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
|
|
//sysnb getgroups(n int, list *_Gid_t) (nn int, err error)
|
|
//sysnb setgroups(n int, list *_Gid_t) (err error)
|
|
//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
|
|
//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
|
|
//sysnb socket(domain int, typ int, proto int) (fd int, err error)
|
|
//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
|
|
//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
|
|
//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
|
|
//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
|
|
//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
|
|
//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
|
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
|
//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
|
|
|
|
func Ioperm(from int, num int, on int) (err error) {
|
|
return ENOSYS
|
|
}
|
|
|
|
func Iopl(level int) (err error) {
|
|
return ENOSYS
|
|
}
|
|
|
|
//sys futimesat(dirfd int, path string, times *[2]Timeval) (err error)
|
|
//sysnb Gettimeofday(tv *Timeval) (err error)
|
|
|
|
func Time(t *Time_t) (tt Time_t, err error) {
|
|
var tv Timeval
|
|
err = Gettimeofday(&tv)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
if t != nil {
|
|
*t = Time_t(tv.Sec)
|
|
}
|
|
return Time_t(tv.Sec), nil
|
|
}
|
|
|
|
//sys Utime(path string, buf *Utimbuf) (err error)
|
|
//sys utimes(path string, times *[2]Timeval) (err error)
|
|
|
|
func setTimespec(sec, nsec int64) Timespec {
|
|
return Timespec{Sec: sec, Nsec: nsec}
|
|
}
|
|
|
|
func setTimeval(sec, usec int64) Timeval {
|
|
return Timeval{Sec: sec, Usec: int32(usec)}
|
|
}
|
|
|
|
func (r *PtraceRegs) PC() uint64 { return r.Tpc }
|
|
|
|
func (r *PtraceRegs) SetPC(pc uint64) { r.Tpc = pc }
|
|
|
|
func (iov *Iovec) SetLen(length int) {
|
|
iov.Len = uint64(length)
|
|
}
|
|
|
|
func (msghdr *Msghdr) SetControllen(length int) {
|
|
msghdr.Controllen = uint64(length)
|
|
}
|
|
|
|
func (cmsg *Cmsghdr) SetLen(length int) {
|
|
cmsg.Len = uint64(length)
|
|
}
|
|
|
|
//sysnb pipe(p *[2]_C_int) (err error)
|
|
|
|
func Pipe(p []int) (err error) {
|
|
if len(p) != 2 {
|
|
return EINVAL
|
|
}
|
|
var pp [2]_C_int
|
|
err = pipe(&pp)
|
|
p[0] = int(pp[0])
|
|
p[1] = int(pp[1])
|
|
return
|
|
}
|
|
|
|
//sysnb pipe2(p *[2]_C_int, flags int) (err error)
|
|
|
|
func Pipe2(p []int, flags int) (err error) {
|
|
if len(p) != 2 {
|
|
return EINVAL
|
|
}
|
|
var pp [2]_C_int
|
|
err = pipe2(&pp, flags)
|
|
p[0] = int(pp[0])
|
|
p[1] = int(pp[1])
|
|
return
|
|
}
|
|
|
|
//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
|
|
|
|
func Poll(fds []PollFd, timeout int) (n int, err error) {
|
|
if len(fds) == 0 {
|
|
return poll(nil, 0, timeout)
|
|
}
|
|
return poll(&fds[0], len(fds), timeout)
|
|
}
|