FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

log.d

 
Post new topic   Reply to topic     Forum Index -> ArcLib
View previous topic :: View next topic  
Author Message
gvv.coder



Joined: 11 Jun 2008
Posts: 5

PostPosted: Wed Jun 11, 2008 2:35 am    Post subject: log.d Reply with quote

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
View user's profile Send private message
clayasaurus



Joined: 21 May 2004
Posts: 857

PostPosted: Thu Jun 12, 2008 11:41 am    Post subject: Reply with quote

I can understand you fine.

It seems you are using the phobos version of ArcLib. The most recent version of ArcLib uses Tango. Tango's log system has replaced ArcLib's logging system because it is more full featured.

http://www.dsource.org/projects/tango

Tango also has many more features to make D programming easier. I recommend you use Tango.

http://www.dsource.org/projects/tango/wiki/DmdDownloads

~ Clay
Back to top
View user's profile Send private message AIM Address
gvv.coder



Joined: 11 Jun 2008
Posts: 5

PostPosted: Fri Jun 13, 2008 5:16 am    Post subject: Reply with quote

Ok, now i'm using tango. Great lib!
Thanks for help.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> ArcLib All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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