[Haskell-cafe] hslogger bugs or features - patches

Marc Weber marco-oweber at gmx.de
Mon Feb 16 11:42:42 EST 2009


> You didn't notice setHandlers?
> 
>   -- | Set the 'Logger'\'s list of handlers to the list supplied.
>   -- All existing handlers are removed first.
>   setHandlers :: LogHandler a => [a] -> Logger -> Logger
> 
> It is perfectly valid to set the root logger's handlers to [] if you
> want it to do nothing at all.

Which type to assign to [] ? Right now I'm using

instance HL.LogHandler () where -- doh! find a better way to pass an empty list below 
  setLevel = error "should never be rearched"
  getLevel = error "should never be rearched"
  emit = error "should never be rearched"
  close = error "should never be rearched"

  HL.updateGlobalLogger "" (HL.addHandler fh . HL.setHandlers ([] :: [()]) )


...
But I'm not satisfied with that. But I couldn't find a better solution
either. Eg I've tried 
[] :: [SyslogHandler] (SyslogHandler is not exported, is it?)
[] :: [GenericHandler ()] (GenericHandler isn't exported either?)

Sincerly
Marc Weber


More information about the Haskell-Cafe mailing list