<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Life and Code &#187; project</title>
	<atom:link href="http://www.karlockhart.com/wordpress/tag/project/feed" rel="self" type="application/rss+xml" />
	<link>http://www.karlockhart.com/wordpress</link>
	<description>Pixels bleed just like us...</description>
	<lastBuildDate>Wed, 14 Jul 2010 17:13:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>XNA Game Demo Update 1</title>
		<link>http://www.karlockhart.com/wordpress/2010/04/22/xna-game-demo-update-1</link>
		<comments>http://www.karlockhart.com/wordpress/2010/04/22/xna-game-demo-update-1#comments</comments>
		<pubDate>Thu, 22 Apr 2010 14:45:41 +0000</pubDate>
		<dc:creator>karl.lockhart</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[car]]></category>
		<category><![CDATA[demo]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[jiglibx]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[xna]]></category>

		<guid isPermaLink="false">http://www.karlockhart.com/wordpress/?p=147</guid>
		<description><![CDATA[So once again, I know, I am going down the building a game demo route. This time using one of my all time favorite games as a target for emulation. I do have alot of stuff going on, with contract work, freelance work, Android dev and everything else. But I know that if you love [...]]]></description>
			<content:encoded><![CDATA[<p>So once again, I know, I am going down the building a game demo route. This time using one of my all time favorite games as a target for emulation. I do have alot of stuff going on, with contract work, freelance work, Android dev and everything else. But I know that if you love doing something you should actually do it and I miss some good deep programming and problem solving.</p>
<p>Here is the obligatory tech details post:</p>
<p>Platform: Windows, XBOX 360 (future)<br />
Graphics etc: XNA<br />
Physics: JigLibX</p>
<p>The plan is to do this to work on this project when I need a break from everything else. I am already enjoying it because &#8216;research&#8217; is fun, see pic below. My goal is to actually put this one out there as an XNA indie game. I promise I wont keep it locked away in my collection of fun stuff I have made for me to play around with. I am looking forward to playing this game myself <img src='http://www.karlockhart.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  and that is a good sign.</p>
<div id="attachment_148" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.karlockhart.com/wordpress/wp-content/uploads/2010/04/research.jpg"><img class="size-medium wp-image-148" title="research" src="http://www.karlockhart.com/wordpress/wp-content/uploads/2010/04/research-300x201.jpg" alt="" width="300" height="201" /></a><p class="wp-caption-text">Research is fun!!</p></div>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2010%2F04%2F22%2Fxna-game-demo-update-1&amp;title=XNA+Game+Demo+Update+1" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2010%2F04%2F22%2Fxna-game-demo-update-1&amp;title=XNA+Game+Demo+Update+1" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2010%2F04%2F22%2Fxna-game-demo-update-1&amp;title=XNA+Game+Demo+Update+1" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2010%2F04%2F22%2Fxna-game-demo-update-1&amp;headline=XNA+Game+Demo+Update+1" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=XNA+Game+Demo+Update+1&amp;url=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2010%2F04%2F22%2Fxna-game-demo-update-1" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=XNA+Game+Demo+Update+1&amp;u=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2010%2F04%2F22%2Fxna-game-demo-update-1" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=XNA+Game+Demo+Update+1&amp;url=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2010%2F04%2F22%2Fxna-game-demo-update-1" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=XNA+Game+Demo+Update+1&amp;url=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2010%2F04%2F22%2Fxna-game-demo-update-1" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=XNA+Game+Demo+Update+1&amp;url=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2010%2F04%2F22%2Fxna-game-demo-update-1" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2010%2F04%2F22%2Fxna-game-demo-update-1&amp;title=XNA+Game+Demo+Update+1&amp;summary=&amp;source=" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2010%2F04%2F22%2Fxna-game-demo-update-1" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2010%2F04%2F22%2Fxna-game-demo-update-1" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2010%2F04%2F22%2Fxna-game-demo-update-1" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.karlockhart.com/wordpress/2010/04/22/xna-game-demo-update-1/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Project First: Space Race Simulator Project</title>
		<link>http://www.karlockhart.com/wordpress/2009/06/01/project-first-space-race-simulator-project</link>
		<comments>http://www.karlockhart.com/wordpress/2009/06/01/project-first-space-race-simulator-project#comments</comments>
		<pubDate>Tue, 02 Jun 2009 05:11:38 +0000</pubDate>
		<dc:creator>karl.lockhart</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[BARIS]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[hot-seat]]></category>
		<category><![CDATA[into]]></category>
		<category><![CDATA[jupiter-c]]></category>
		<category><![CDATA[moon]]></category>
		<category><![CDATA[physics]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[project first]]></category>
		<category><![CDATA[race]]></category>
		<category><![CDATA[rocket]]></category>
		<category><![CDATA[simulation]]></category>
		<category><![CDATA[space]]></category>
		<category><![CDATA[xna]]></category>

		<guid isPermaLink="false">http://www.karlockhart.com/wordpress/?p=59</guid>
		<description><![CDATA[I loved Buzz Aldrin's Race into space when I first played it several years ago. The things I wish I could change about that simulator are the things I am attempting to put into my own idea of a space race hot seat simulator. For example in BARIS, launches played the same videos over and over again, in a modern sim, there is no reason why these launches could not be dynamically simulated based on the current tech level. Even on a modest computer, using modern graphics techniques, it should be possible to create a compelling sim with dynamically generated and simulated mission launches. I am testing this concept with my Project First, I want to see how cool of a Space Race launch I can simulate with XNA.]]></description>
			<content:encoded><![CDATA[<p>I loved Buzz Aldrin&#8217;s Race into space when I first played it several years ago. The things I wish I could change about that simulator are the things I am attempting to put into my own idea of a space race hot seat simulator. For example in BARIS, launches played the same videos over and over again, in a modern sim, there is no reason why these launches could not be dynamically simulated based on the current tech level. Even on a modest computer, using modern graphics techniques, it should be possible to create a compelling sim with dynamically generated and simulated mission launches. I am testing this concept with my Project First, I want to see how cool of a Space Race launch I can simulate with XNA.</p>
<p>I have started with a simple goal for now, model the crafts and locations to dynamically generate the Explorer I mission, not necessarily to real life spec. But to a decently realistic and good looking level of detail. To this end, I am working on modelling the Jupiter-C launch vehicle <img src='http://www.karlockhart.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  using correct dimensions weights etc. I will use this to create a pretty basic simulation in XNA and build on it adding stuff like the engine sounds I am also working on <img src='http://www.karlockhart.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Here is a preview of some of the stuff I have coming <img src='http://www.karlockhart.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Audio:<br />
The audio was created in Audacity using a high pressure cigarette lighter as the base sound, then I pretty much massaged it down a bit to get a nice roar. The start just uses reverb and amplitude changes to give the feeling of that initial surge at rocket startup. Pretty simple sounds to create so far. Kinda fun to be playing with audio again <img src='http://www.karlockhart.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .<br />
<a class="alignleft" title="Engine Start (WIP)" href="http://www.karlockhart.com/board_files/engine_start.mp3" target="_blank">Engine Start</a><br />
<a class="alignleft" title="Engine Run (RC)" href="http://www.karlockhart.com/board_files/engine_run.mp3" target="_blank">Engine Run</a></p>
<p>Images:</p>
<div id="attachment_60" class="wp-caption alignleft" style="width: 310px"><a href="http://www.karlockhart.com/wordpress/wp-content/uploads/2009/06/rocketdyne_tailsect3.jpg"><img class="size-medium wp-image-60" title="Blender: RocketDyne Booster Tail Section" src="http://www.karlockhart.com/wordpress/wp-content/uploads/2009/06/rocketdyne_tailsect3-300x180.jpg" alt="Jupiter-C RocketDyne Booster Tail Section" width="300" height="180" /></a><p class="wp-caption-text">Jupiter-C RocketDyne Booster Tail Section</p></div>
<p>For fellow BARIS lovers, the game has been open-sourced and can be found <a title="SourceForge - Race Into Space" href="http://sourceforge.net/projects/raceintospace" target="_blank">here</a></p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2009%2F06%2F01%2Fproject-first-space-race-simulator-project&amp;title=Project+First%3A+Space+Race+Simulator+Project" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2009%2F06%2F01%2Fproject-first-space-race-simulator-project&amp;title=Project+First%3A+Space+Race+Simulator+Project" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2009%2F06%2F01%2Fproject-first-space-race-simulator-project&amp;title=Project+First%3A+Space+Race+Simulator+Project" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2009%2F06%2F01%2Fproject-first-space-race-simulator-project&amp;headline=Project+First%3A+Space+Race+Simulator+Project" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Project+First%3A+Space+Race+Simulator+Project&amp;url=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2009%2F06%2F01%2Fproject-first-space-race-simulator-project" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Project+First%3A+Space+Race+Simulator+Project&amp;u=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2009%2F06%2F01%2Fproject-first-space-race-simulator-project" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Project+First%3A+Space+Race+Simulator+Project&amp;url=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2009%2F06%2F01%2Fproject-first-space-race-simulator-project" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Project+First%3A+Space+Race+Simulator+Project&amp;url=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2009%2F06%2F01%2Fproject-first-space-race-simulator-project" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Project+First%3A+Space+Race+Simulator+Project&amp;url=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2009%2F06%2F01%2Fproject-first-space-race-simulator-project" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2009%2F06%2F01%2Fproject-first-space-race-simulator-project&amp;title=Project+First%3A+Space+Race+Simulator+Project&amp;summary=&amp;source=" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2009%2F06%2F01%2Fproject-first-space-race-simulator-project" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2009%2F06%2F01%2Fproject-first-space-race-simulator-project" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2009%2F06%2F01%2Fproject-first-space-race-simulator-project" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.karlockhart.com/wordpress/2009/06/01/project-first-space-race-simulator-project/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
<enclosure url="http://www.karlockhart.com/board_files/engine_start.mp3" length="101385" type="audio/mpeg" />
<enclosure url="http://www.karlockhart.com/board_files/engine_run.mp3" length="101385" type="audio/mpeg" />
		</item>
		<item>
		<title>Very Basic Logging for C++</title>
		<link>http://www.karlockhart.com/wordpress/2009/01/04/very-basic-logging-for-c</link>
		<comments>http://www.karlockhart.com/wordpress/2009/01/04/very-basic-logging-for-c#comments</comments>
		<pubDate>Mon, 05 Jan 2009 02:24:01 +0000</pubDate>
		<dc:creator>karl.lockhart</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[logger]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[project]]></category>

		<guid isPermaLink="false">http://www.karlockhart.com/wordpress/?p=28</guid>
		<description><![CDATA[I am always in need of very basic logging for my projects, here is the logger I wrote for my XPFF project, remember this code is as-is as the project is still very active: /* * Logger.h * * Created on: Jan 4, 2009 * Author: Karl */ #include &#60;iostream&#62; #include &#60;fstream&#62; #include &#60;string&#62; #include [...]]]></description>
			<content:encoded><![CDATA[<p>I am always in need of very basic logging for my projects, here is the logger I wrote for my XPFF project, remember this code is as-is as the project is still very active:</p>
<pre><span id="more-28"></span>/*
 * Logger.h
 *
 *  Created on: Jan 4, 2009
 *      Author: Karl
 */
#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;string&gt;
#include &lt;time.h&gt;

#ifndef LOGGER_H_
#define LOGGER_H_

class Logger {
public:
	static Logger* Instance();
	~Logger();

	//Logging Levels
	const static int LOG_LEVEL_NO_LOGGING = 0;
	const static int LOG_LEVEL_FATAL = 1;
	const static int LOG_LEVEL_SEVERE = 2;
	const static int LOG_LEVEL_WARNING = 3;
	const static int LOG_LEVEL_INFO = 4;
	const static int LOG_LEVEL_CONFIG = 5;
	const static int LOG_LEVEL_VERBOSE = 6;
	const static int LOG_LEVEL_VERY_VERBOSE = 7;

	//Logging Targets
	const static int LOG_TARGET_FILE = 1;
	const static int LOG_TARGET_STDOUT = 2;
	const static int LOG_TARGET_BOTH = 3;

	void SetLoggingLevel(int);

	void SetLoggingTarget(int);

	void Log(int, std::string);

protected:
	Logger();
	Logger(const Logger&amp;);
	Logger&amp; operator= (const Logger&amp;);

private:
	std::ofstream file;
	static Logger* pinstance;
};

#endif /* LOGGER_H_ */</pre>
<pre>/*
 * Logger.cpp
 *
 *  Created on: Jan 4, 2009
 *      Author: Karl
 */

#include "Logger.h"

Logger* Logger::pinstance = 0;
int loggingLevel = 4;
int loggingTarget = 1;

Logger* Logger::Instance()
{
	if (pinstance == 0)
	{
		pinstance = new Logger;
	}
	return pinstance;
}

Logger::Logger()
{
	file.open ("logger.log");
	Log(LOG_LEVEL_INFO, "Log Opened");
}

Logger::~Logger()
{
	file.close();
}

void Logger::SetLoggingLevel(int logLevel)
{
	if ((logLevel &gt;= LOG_LEVEL_NO_LOGGING) &amp;&amp; (logLevel &lt;= LOG_LEVEL_VERY_VERBOSE))
	{
		loggingLevel = logLevel;
	}
}

void Logger::SetLoggingTarget(int logTarget){
	if ((logTarget &gt;= LOG_TARGET_FILE) &amp;&amp; (logTarget &lt;= LOG_TARGET_BOTH))
	{
		loggingTarget = logTarget;
	}
}

void Logger::Log(int logLevel, std::string logMsg)
{
	if (logLevel &lt;= loggingLevel)
	{
		std::string msgToWrite;
		time_t rawtime;
		struct tm * timeinfo;

		time ( &amp;rawtime );
		timeinfo = localtime ( &amp;rawtime );
		msgToWrite += asctime(timeinfo);
		msgToWrite.erase(msgToWrite.end()-1,msgToWrite.end());
		msgToWrite += " - ";

		switch (logLevel) {

		case LOG_LEVEL_FATAL:
			msgToWrite += "FATAL - ";
			break;
		case LOG_LEVEL_SEVERE:
			msgToWrite += "SEVERE - ";
			break;
		case LOG_LEVEL_WARNING:
			msgToWrite += "WARNING - ";
			break;
		case LOG_LEVEL_INFO:
			msgToWrite += "INFO - ";
			break;
		case LOG_LEVEL_CONFIG:
			msgToWrite += "CONFIG - ";
			break;
		case LOG_LEVEL_VERBOSE:
			msgToWrite += "VERBOSE - ";
			break;
		case LOG_LEVEL_VERY_VERBOSE:
			msgToWrite += "VERY VERBOSE - ";
			break;
		default:
			msgToWrite += "UNKNOWN LEVEL - ";
			break;
		}

		msgToWrite += logMsg;
		msgToWrite += "\n";

		switch(loggingTarget){
		case LOG_TARGET_FILE:
			file &lt;&lt; msgToWrite;
			break;
		case LOG_TARGET_STDOUT:
			std::cout &lt;&lt; msgToWrite;
			break;
		case LOG_TARGET_BOTH:
			msgToWrite += "\n";
			file &lt;&lt; msgToWrite;
			std::cout &lt;&lt; msgToWrite;
			break;
		}
	file.flush();
	}

}</pre>
<p>Example Usage:</p>
<p>Logger *logger = Logger::Instance();</p>
<p>.</p>
<p>.</p>
<p>.</p>
<p>logger-&gt;Log(logger-&gt;LOG_LEVEL_INFO, &#8220;Starting the Plugin&#8221;);</p>
<p> </p>
<pre> </pre>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2009%2F01%2F04%2Fvery-basic-logging-for-c&amp;title=Very+Basic+Logging+for+C%2B%2B" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2009%2F01%2F04%2Fvery-basic-logging-for-c&amp;title=Very+Basic+Logging+for+C%2B%2B" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2009%2F01%2F04%2Fvery-basic-logging-for-c&amp;title=Very+Basic+Logging+for+C%2B%2B" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2009%2F01%2F04%2Fvery-basic-logging-for-c&amp;headline=Very+Basic+Logging+for+C%2B%2B" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Very+Basic+Logging+for+C%2B%2B&amp;url=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2009%2F01%2F04%2Fvery-basic-logging-for-c" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Very+Basic+Logging+for+C%2B%2B&amp;u=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2009%2F01%2F04%2Fvery-basic-logging-for-c" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Very+Basic+Logging+for+C%2B%2B&amp;url=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2009%2F01%2F04%2Fvery-basic-logging-for-c" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Very+Basic+Logging+for+C%2B%2B&amp;url=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2009%2F01%2F04%2Fvery-basic-logging-for-c" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Very+Basic+Logging+for+C%2B%2B&amp;url=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2009%2F01%2F04%2Fvery-basic-logging-for-c" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2009%2F01%2F04%2Fvery-basic-logging-for-c&amp;title=Very+Basic+Logging+for+C%2B%2B&amp;summary=&amp;source=" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2009%2F01%2F04%2Fvery-basic-logging-for-c" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2009%2F01%2F04%2Fvery-basic-logging-for-c" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Fwww.karlockhart.com%2Fwordpress%2F2009%2F01%2F04%2Fvery-basic-logging-for-c" ><img class="lightsocial_img" src="http://www.karlockhart.com/wordpress/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.karlockhart.com/wordpress/2009/01/04/very-basic-logging-for-c/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
