View previous topic :: View next topic |
Author |
Message |
gvv.coder
Joined: 11 Jun 2008 Posts: 5
|
Posted: Wed Jun 11, 2008 2:35 am Post subject: log.d |
|
|
Sorry for my bad english, that not my native langugage. If you speak on russian or esperanto then we can tajk on it.
I change some functions on log.d. Z think that is more comfortly:
Code: |
/// initialization stub
void open(bool wrt=false) { _wstdout = wrt; }
|
Add some lines:
Code: |
/// Write a message to the log
void write(char[] filename, char[] functionName, char[] errorLevel, ...)
in
{
// force program to quit if
if (errorLevel != "info" &&
errorLevel != "warn" &&
errorLevel != "error")
{
// print to log the reason to quit
lines.length = lines.length+1;
lines[lines.length-1] = LogMessage("log", "write", "error", "Error Level " ~ errorLevel ~ " is invalid");
// force quit
arc.input.quit();
}
}
body
{
// write the line into our logging system
lines.length = lines.length+1;
lines[lines.length-1] = LogMessage(filename, functionName, errorLevel, toUTF8(formatString(_arguments, _argptr)));
// force program to quit on errors
if (errorLevel == "error")
arc.input.quit();
/++ write always. I add that+/
if (_wstdout) print();
}
|
and i change function:
Code: |
// convert log message into a string
char[] toString()
{
char[] retStr = "(" ~ errorLevel ~ ") | in file " ~ filename ~ ", function: " ~ functionName ~ " - " ~ message ~ "\n";
return retStr;
}
|
add at end:
Code: |
/++ Write or not to stdout. Default false +/
bool _wstdout = false;
|
If you init logger like that: open(true), then it alway write in terminal.
Also, what about this using:
Code: |
arc.log.write(__FILE__, "somefunc()", "info", "Some text")
|
Sorry for my lang. Also i'm beginner coder. |
|
Back to top |
|
|
clayasaurus
Joined: 21 May 2004 Posts: 857
|
|
Back to top |
|
|
gvv.coder
Joined: 11 Jun 2008 Posts: 5
|
Posted: Fri Jun 13, 2008 5:16 am Post subject: |
|
|
Ok, now i'm using tango. Great lib!
Thanks for help. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|