Jump to content
  • Advertisement
Sign in to follow this  
Peter_APIIT

C++ Logger Tutorial

This topic is 3254 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello to all, i am a student and i would like to develop a simple C++ logger for my project. I have did quite amount of research including link listed below but i could not understand how it works.
Quote:
http://www.gamedev.net/reference/snippets/features/stlLogSnippet/ http://www.codeproject.com/KB/cpp/CPP_logging.aspx http://www.velocityreviews.com/forums/t288879-efficient-logging-in-c.html http://software.intel.com/en-us/articles/building-of-systems-of-automatic-cc-code-logging/ http://developers.sun.com/solaris/articles/logging.html http://www.karlockhart.com/wordpress/2009/01/04/very-basic-logging-for-c/ http://www.serverwatch.com/tutorials/article.php/1129851 http://www.serverwatch.com/tutorials/article.php/3376671 http://docs.hp.com/en/B9901-90031/ch04s05.html http://www.loganalysis.org/ http://www.torjo.com/code/logging-v131.zips
Question: 1. What is the usage/function/purposes of ifdef DEBUG and compare to class? 2. What function should a logger have ? Logger Requirement: 1. Develop in C++ template or class 2. Portable approach like Consider logging to std::clog. You can replace the clog streambuf with the streambuf of your choice (to a file, socket, window, stdout, stdcerr whatever). Example code is welcome. Thanks for any advice.

Share this post


Link to post
Share on other sites
Advertisement
Those questions and requirements sound like they were taken directly off your class assignment.


Go back and read those articles you listed.



The two questions are answered directly in a few of those articles.

Several of those articles have complete code listings for logging classes that satisfy your requirements and more. It should be more than enough to cover everything you need to know for your course.


If you have other specific questions (rather than asking us to do your homework), please feel free to ask those.

Share this post


Link to post
Share on other sites
Quote:
Original post by Peter_APIIT
Question:
1. What is the usage/function/purposes of ifdef DEBUG and compare to class?

This doesn't really make sense.

Quote:

2. What function should a logger have ?

It's your logger. You know best.


Quote:

Logger Requirement:
1. Develop in C++ template or class
2. Portable approach like Consider logging to std::clog. You can replace the clog streambuf
with the streambuf of your choice (to a file, socket, window, stdout, stdcerr
whatever).

Example code is welcome.

Thanks for any advice.

In the other thread you started with exactly the same title, you were given links to example code, techniques and tutorials. Were they not sufficient?

Share this post


Link to post
Share on other sites
This is not a homework. I code it during my spare time.

I would like to understand these issues first before i start implement it.

Thanks for your help.

Share this post


Link to post
Share on other sites
Loggers with a bunch of features are often unnecessary for most hobby game projects. If you really are writing a logger for one of your own projects, what features do you really need?

If you just need to log simple messages to a file, why not just use std::ofstream?

Share this post


Link to post
Share on other sites
Yes, i willing to use ofstream but i need to clear the myth.

Does logger logging another program at run time ?

How to achieve that ?

Thanks.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!