packages feed

backdropper-1.1: src/Logger_logic.hs

-- |
-- * Logger logic: a small wrapper to hslogger.
--
-- [@Author@] Yann Golanski.
--
-- [@Maintainer@] Yann Golanski <yann@kierun.org>
--
-- [@Description@] Wrapper to hslogger to get the time in front of the message.
--
-- (c)2008 Yann Golanski, GPLv3 or above.
--
--  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
--  the Free Software Foundation, either version 3 of the License, or
--  (at your option) any later version.
--
--  This program is distributed in the hope that it will be useful,
--  but WITHOUT ANY WARRANTY; without even the implied warranty of
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--  GNU General Public License for more details.
--
--  You should have received a copy of the GNU General Public License
--  along with this program.  If not, see <http://www.gnu.org/licenses/>.
--
--
module Logger_logic where
import System.Log.Logger
import System.Log.Handler.Syslog
import System.Time

{------------------------------------------------------------------------------}
-- | Prints a logger message.
logger :: Priority -- ^ A priority of the message.
       -> [Char] -- ^ A string to be logged.
       -> IO () -- ^ The IO monad.
logger lvl str = 
  do epoch <- getClockTime
     ook <- getLogger "backdropper"
     logL ook lvl $ (show epoch) ++ " [" ++ (show lvl) ++ "]  " ++ str

{------------------------------------------------------------------------------}