Let's talk about runtime/logging library
This week, I will mention quickly the Eiffel Logging library, it is mainly contributed by "ITPassion Ltd." (http://www.itpassion.com), and is now maintained by Eiffel Software.
This library addresses the need to write messages to a log file, or other kind of log supports. But each platforms has its own way to gather these messages (log files, syslog daemon, event log, ...)
The Eiffel Logging Library aims to resolve these differences by providing one interface to access them, while making sure the right platform methods are used under the hood. So that the same code runs on multiple platforms. In addition, it is possible to extend logging interface to store log message into database, or whatever mean seems fit to the developer of the application universe.
The library source code is located at
- from EiffelStudio installation: $ISE_LIBRARY/
- from subversion repository: https://svn.eiffel.com/eiffelstudio/trunk/Src/library/runtime/logging
It is under the licence: "Eiffel Forum v2".
The associated examples
- from EiffelStudio: $ISE_LIBRARY/examples/runtime/logging/eventlog
- from subversion: https://svn.eiffel.com/eiffelstudio/trunk/Src/examples/runtime/logging
- eventlog and syslog are the same example (one for Windows eventlog, and the other for syslog daemon; but both have the same source code with different comment).
- filelog: use the default FILE_LOG_WRITER
- multiclass: using different logger in different class (for instance one log into stderr, and another into system.log), or the same log from different classes (thanks to once)
- multilog: logger can write message to different output (for instance, stderr AND system.log)
- multiplatform: demonstrate that log are written in eventlog on Windows, and syslog daemon in linux for instance)
- multithreading: how to use logger in a concurrent system (Eiffel Thread)
- suspend: it is possible to suspend one or all logs, and resume one or all logs.
Learn by code
Under "doc" subfolder :
- Readme.1st : overview of the library structure
- Arch_Design_and_Impl.pdf : The Architecture and Implementation documentation, in PDF format.
UPDATED 2014-march: the logging library now support unicode, please update your code to use routines based on PATH, and remove the usage of FILE_NAME.