Tuning up Logog.

43 views
Skip to first unread message

Ivan Timofeev

unread,
Oct 27, 2011, 5:12:47 PM10/27/11
to Logog
Is it possible to tune up the Logog system so that it would not show
file name and line number but show current time?

Oct-27-11 11:35:20 info: Robot is initialized.
Oct-27-11 11:35:24 info: Robot's arm extended.

Thanks.

John Byrd

unread,
Oct 27, 2011, 7:11:51 PM10/27/11
to lo...@googlegroups.com
Seemed pretty straightforward, so I added a few lines of code and
documentation, please review
http://johnwbyrd.github.com/logog/customformatting.html and download
the latest. You may have to subclass your own custom Formatter object
if you want a highly particular log format -- please see that page for
more details.

jwb

> --
> You received this message because you are subscribed to the Google Groups "Logog" group.
> To post to this group, send email to lo...@googlegroups.com.
> To unsubscribe from this group, send email to logog+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/logog?hl=en.
>
>

--
---

John Byrd
Gigantic Software
2102 Business Center Drive
Suite 144
Irvine, CA   92612-1001
http://www.giganticsoftware.com
T: (949) 892-3526 F: (206) 309-0850

Ivan Timofeev

unread,
Nov 1, 2011, 11:09:12 AM11/1/11
to Logog
Hi.

I have subclassed the Formatter class:

CustomFormatter : public Formatter

and overridden the Format function. How do I use the new formatter?

CustomFormatter formatter = new CustomFormatter(); ? In this case, the
Format method is never called. I have missed something.

Ivan Timofeev

unread,
Nov 1, 2011, 12:34:02 PM11/1/11
to Logog
Yeah, I got it.

I need to call SetFormatter

logog::LogFile myLogFile("FileName");
myLogFile.SetFormatter(newFormatter);

For some reason I cannot print anything. The output file is just
empty.

In the new Formatter I am only using time, warning level, and the
message:

LOGOG_STRING &FormatterGCC::Format( const Topic &topic, const Target
&target )
{

TOPIC_FLAGS flags;
flags = topic.GetTopicFlags();

m_sMessageBuffer.clear();

RenderTimeOfDay();

if ( flags & TOPIC_LEVEL_FLAG )
{

m_sMessageBuffer.append( ErrorDescription( topic.Level() ) );
m_sMessageBuffer.append(": ");
}


if ( flags & TOPIC_MESSAGE_FLAG )
{
m_sMessageBuffer.append( topic.Message() );
m_sMessageBuffer.append( '\n' );
}

if ( target.GetNullTerminatesStrings() )
m_sMessageBuffer.append( (char)NULL );

return m_sMessageBuffer;
}

Ivan Timofeev

unread,
Nov 1, 2011, 1:50:46 PM11/1/11
to Logog


It is done! it was my fault.

Thanks.
Reply all
Reply to author
Forward
0 new messages