Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I created my own custom back end to log into a file. I dont know how to print the severity level as a string. Pantheios stock backend does this. But I could not trace it back how it does.

Please anyone help me to do this

Thanks in advance
Posted
Comments
Richard MacCutchan 2-May-13 5:21am    
Use printf, fprintf or sprintf as appropriate.
Jochen Arndt 2-May-13 5:27am    
You may show us how your current log function is defined and how you print. Without seeing this, it is difficult to answer.

If the severity is defined by an integer, you usually would have an array of severity strings:
const char lpszSeverities[] = { "Emergency", "Alert", /*..., */ "Debug" };
fprintf(fOut, "%s: %s", lpszSeverities[nSeverity], lpszMsg);
Subha Elangovan 3-May-13 9:12am    
thank you. It works :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900