Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

A better logging class

Posted on 2003-11-07
8
Medium Priority
?
353 Views
Last Modified: 2010-04-01
hello
I’m trying to make myself a better logging class, I got all the basic down and it works adequately and i getting ready to add the advances features...
i am using Visual studio 6, NOT vs.net

i was wondering how i would show the function that the log() function was called from
ie:  [CFooClass::FooMethod()]
and from what file and line it came from.
ie:  [File: C:\cpp\logy\log.cpp line: 195]

in the end i want something like this.
ie
[Fri Nov 07 15:48:38 2003] [File: C:\cpp\logy\log.cpp line: 195] [CFooClass::FooMethod()] this is an error message

i see this done in .net
http://www.codeproject.com/managedcpp/smartlog.asp
and in a lot of other games and appz when they crash.
So It must be possible
0
Comment
Question by:funvill
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 3

Expert Comment

by:Kashra
ID: 9705468
Well, I use VC .NET, but I'd assume that VC 6 should also have the ANSI standard macros for determining filenames.

__DATE__
__FILE__
__LINE__
__STDC__
__TIME__
__TIMESTAMP__

If you use those in your code, the compiler should recognize them. If not, then try to use a compiler flag to force ANSI compliance. I know VC6 isn't very compliant in comparison to .NET, but this seems simple enough.
0
 
LVL 3

Accepted Solution

by:
Kashra earned 200 total points
ID: 9705472
0
 
LVL 2

Author Comment

by:funvill
ID: 9705490
Perfect thank you so much
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 3

Expert Comment

by:Sandra-24
ID: 9711063
Hey funvill I could use a logging function like that, would you like to share your code with me?
0
 
LVL 2

Author Comment

by:funvill
ID: 9711909
ya sure just give me a day to document it, so you don’t have to go searching thou my code

0
 
LVL 2

Author Comment

by:funvill
ID: 9712088
Still working a few things but it works
http://downloads.funvill.com/stuff/logy_v0.01aA.zip

E-mail me with comments or suggestions
if you are using .net use this
http://www.codeproject.com/managedcpp/smartlog.asp
its done better then mine
0
 
LVL 3

Expert Comment

by:Sandra-24
ID: 9726376
Looks good, thanks funvill. If i make any changes to it or have any comments I'll e-mail you.

Only one nitpick, flages is actually spelled flags:) But that is easily fixed with a search and replace.

Otherwise *deletes her own log function* it looks very good. Thanks for sharing.

What sort of project are you working on as a matter of interest?

-Sandra
0
 
LVL 3

Expert Comment

by:Sandra-24
ID: 9726488
Oh now I see flages is a seperate thing from flags:) I thought your english was too good for a simple error like that!
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question