X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fcypherpunks.ru%2Fgovpn%2Flogger.go;h=48a32356d928b6f07ba461628c868bee90f437d8;hb=572cac17bde738055312f7a468a0bde0e760a262;hp=f646338a037c0a2cb7fe271ca6f5857d5b8ebac3;hpb=649e55e1ead338121ea76d6ae1187617ea9839d6;p=govpn.git diff --git a/src/cypherpunks.ru/govpn/logger.go b/src/cypherpunks.ru/govpn/logger.go index f646338..48a3235 100644 --- a/src/cypherpunks.ru/govpn/logger.go +++ b/src/cypherpunks.ru/govpn/logger.go @@ -1,6 +1,6 @@ /* GoVPN -- simple secure free software virtual private network daemon -Copyright (C) 2014-2016 Sergey Matveev +Copyright (C) 2014-2017 Sergey Matveev This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -36,12 +36,20 @@ func SyslogEnable() { } } -// Call either syslog-related logger.Println if SyslogEnabled, -// default log.Println otherwise. -func Println(v ...interface{}) { +// Call either syslog-related logger.Printf if SyslogEnabled, +// default log.Printf otherwise. +func Printf(f string, v ...interface{}) { if sysloger == nil { - log.Println(v...) + log.Printf(f, v...) } else { - sysloger.Println(v...) + sysloger.Printf(f, v...) + } +} + +// Call both default log.Printf and syslog-related one. +func BothPrintf(f string, v ...interface{}) { + log.Printf(f, v...) + if sysloger != nil { + sysloger.Printf(f, v...) } }