ConcurrentLogger is a quite simple .NET class that allows you to write a unique and sequential log file from a multi-thread application. I am programming robotics applications using MSRS, and I wanted to generate an independent log file that could be safely created from a multithreaded and asynchronous application.
I looked for other .NET components or libraries for logging, like log4net, CSharp Logger, Logger.Net, etc. However, I couldn't find a simple library able to manage complete asynchronous use. Then, I decided to use the CCR library to write a really simple logger component that allows me to just define a log level and call a simple method to write a log line everytime a need it.
This is an example of use in C# (C Sharp):
[...] ConcurrentLogger logger = new ConcurrentLogger( "MyLogFile.txt", LogLevel.DEBUG ); [...] logger.writeLog( "MyComponent", LogLevel.INFO, "This is a test INFO message" ); [...]
Predefined log levels (defined in LogLevel static class) are:
- DEBUG: trace everything. - INFO: aka verbose. Everything is logged. - WARN: medium level of log. All messages defined as error, warn and fatal are logged. - ERROR: log all messages except those defined as debug. - FATAL: the lower level of log, only fatal messages are logger.
As this class makes use of the CCR library you need to include a reference to the CCR in your Visual Studio project. The CCR library is freely available and distributed within Microsoft Robotics Studio SDK. Using the CCR, ConcurrentLogger assures that all calls that cause to write a log line in the log file are executed in the very single thread even though the calls are generated concurrently and asynchronously from different threads. The call to writeLog is always non-blocking. Log messages are enqueued and dispatched in a exclusive fashion (single thread).
More documentation about this component:
Related Items:
- ConcurrentLogger Beta 1 Source Code
- Microsoft Robotics Studio Pages
- Finding papers about consciousness and robotics
- Cognitive Robotics
- Global Workspace Theory (GWT)
- Multiple Draft Model
- Higher Order Theories of Consciousness
- Asimo Fall
- Robotic Mule
- ICybie dancing
Add as favourites (84) | Quote this article on your site | Views: 2077 | E-mail
Only registered users can write comments. Please login or register. Powered by AkoComment Tweaked Special Edition v.1.4.4 |