Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame
I needed to create an HTML logger that would be portable across Win32 and VXWorks OSs. This code was written in a weekend, so don't judge it severely.
What the Code Does
This code does not use MFC or any other library. To provide thread safety, there are a couple of classes (namely CLock and CGuard) that help make the code safe.
Furthermore, there are additional helper classes that hide nasty details:
- CGenFile—hides the file access details.
- CLogFont—generally an implementation of the HTML font tag.
- CLogColor—an implementation of the HTML color.
- CSmartString—a string class.
Using the Code
Instantiate CHtmlLogger in your code, create the log, and then create as many HTML tables (reports) as you wish.
CHtmlLogger Log; Log.Create( "FirstHMLLog.htm" ); //Create a table with three columns Log.CreateTable( 3, "First HTML log" ); //Fill the columns Log.SetColumn( 0, "Heading1" ); Log.SetColumn( 1, "Heading2" ); Log.SetColumn( 2, "Heading3" ); //Add the line specifying the line type (header in this case) Log.AddLine( 0, CHtmlLogger::LT_Header );
Kindergarten stuff, right? The return values validation was removed for clarity. You should look at the sample provided to see the full API. The sample will create the sample log you see in the picture.