Made an addition to the USerial library to support logging of binary messages (so far only cl-log supported).
Here is the latest tarball: userial_0.4.2011.04.11.tar.gz and its signature: userial_0.4.2011.04.11.tar.gz.asc.
Made an addition to the USerial library to support logging of binary messages (so far only cl-log supported).
Here is the latest tarball: userial_0.4.2011.04.11.tar.gz and its signature: userial_0.4.2011.04.11.tar.gz.asc.
One of the things that my current work does better than anywhere I’ve worked before is logging. When something goes wrong, there is a log file that you can dig through to find all kinds of information about what you were doing and how things were going.
As I move forward programming a game with my UNet library, I want to make sure that I can easily log all the network traffic during testing runs at least.
In looking through the various Lisp logging packages out there, I decided on Nick Levine’s cl-log library.
I installed it in no time with quicklisp.
Then, I set to work trying to figure out how I could use it to log binary data.
Here’s what I ended up with. If you want to do something similar, this should give you a good starting point.
With my USerial library, I defined a serializer to keep track of the different categories of log messages. And, I made corresponding categories in cl-log.
There are two major classes that I specialized: base-message and base-messenger. For my toying around, I didn’t end up adding any functionality to the base-message class. I will show it here though so that you know you can do it.
Then, I overrode the messenger-send-message generic function to create a binary header with my USerial library and then write the header and the message out.
To get things going, I then made a log manager that accepts my serialized-message type and started one of my serialized-messenger instances.
Once these were started, I made a little utility function to make it easy for me to make test messages and then invoked log-message a few times.
In all, it has taken me about four times as long to write blog post as it did to install cl-log with quicklisp, peek through the cl-log documentation and source code enough to figure out how to do this, and write all of the code.
To really use this, I will probably separate out the category of a message from the serialized type of the message. This will probably involve adding a field to the serialized-message class to track the message type, adding an initialize-instance :before method for that class to look through the arguments to pull out the type, and then adding the type as an extra argument to log-message.
Wow. A post that I made in February of 2009 just hit Hacker News yesterday and this one from June of 2009 either hit as well or came along for the ride. Suddenly, I have 3655 hits on a two year old articles. Wacky.
Elliott Johnson provided me with some patches for my CL-FFT library so that it will work with Allegro modern mode (mlisp).
Thank you!
Today was the first time that I really kicked the tires on Common Lisp’s conditions and restarts. I thought that I’d share some of the experience as a sort of mini-tutorial. This tutorial assumes some minimal experience hitting the debugger from the REPL and some comfort with CLOS.
Lisp: Conditions and Restarts from Patrick Stein on Vimeo.
Screencast tutorial on basic conditions and restarts in Common Lisp.
Here is the source code generated during this tutorial.