You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by steven liu <st...@gmail.com> on 2011/09/06 12:18:06 UTC

Debug third party API library

Dear All,

I am now working on a plugin which calls a third party API library. I am
able to use TSDebug() in plugin to print out debug infomation. But when I
use printf in my API, I cannot get the printing information on
screen/terminal. I also tried to open a file in my API and save the debug
info to the file. But I cannot find the file. The API can be called
properly. The only issue is that I cannot get debug information inside the
API. Many thanks for your help.

Rgds,
Steve

On Sat, Sep 3, 2011 at 8:56 AM, John Plevyak <jp...@acm.org> wrote:

> Sorry to chime in on this so late.
>
> If the APIs were not already TSXXX I would have preferred to make the
> external ones ats_
> and the internal ts_, but now that we are already down the path I agree
> with
> Leif that we should
> change all the internal apis to ats_.
>
> The downside is that* ink_ *can be done fast with the right hand while ats_
> uses both
> the left pinky for the 'a' and then for the _ (for me) which makes typing
> it
> slower :)
>
> john
>
> On Mon, Aug 29, 2011 at 5:36 AM, Leif Hedstrom <zw...@apache.org> wrote:
>
> > On Aug 29, 2011, at 5:03 AM, Igor Galić <i....@brainsware.org> wrote:
> >
> > >
> > >
> > > ----- Original Message -----
> > >> Hi all,
> > >>
> > >> I'd like to propose that we start using ats_ as a prefix for new APIs
> > >> (and rewrites etc.) in the internal code. Long term, we probably
> > >
> > > Can you please break down for us what exactly internal code is.
> >
> > Anything that is not external / public API.
> >
> > >
> > >> should
> > >> migrate existing ink_ prefixes to ats_, and perhaps also consider
> > >> using
> > >> C++ name spaces.  My rationale for using "ats" instead "ts" in the
> > >
> > > So this is - in the long term, going to be more than a
> > >
> > >  sed -i 's/\bink_/ats_/g' **/*.cc **/*.[ch]
> >
> > Maybe. The prefix ink just doesn't make sense in Apache.
> >
> > >
> > >> internal (core) code is to make it easily distinguishable from the
> > >> public APIs (which are all prefix e.g. TS or ts). This is very useful
> > >> when grepping through the code IMO.
> > >
> > > Just have to teach people *how* to grep ;)
> > >
> > > igalic@tynix ~/src/asf/trafficserver (svn)-[trunk:1162727] % ack-grep
> > '\bink_'  | wc -l
> > > 8333
> > > igalic@tynix ~/src/asf/trafficserver (svn)-[trunk:1162727] % ack-grep
> > 'ink_'  | wc -l
> > > 8540
> > > igalic@tynix ~/src/asf/trafficserver (svn)-[trunk:1162727] %
> >
> >
> > Ya, but if we change ink to ts, this would now find both public APIs and
> > code, and the core code. The message was not really about whether we
> should
> > keep ink or not, I think that's a given, it's whether it should be ts or
> > ats. And I'd prefer ats myself.
> >
> > -- Leif
> >
> > >
> > >> Cheers,
> > >>
> > >> -- Leif
> > >
> > >
> > > So long,
> > >
> > > i
> > >
> > > --
> > > Igor Galić
> > >
> > > Tel: +43 (0) 664 886 22 883
> > > Mail: i.galic@brainsware.org
> > > URL: http://brainsware.org/
> > > GPG: 571B 8B8A FC97 266D BDA3  EF6F 43AD 80A4 5779 3257
> >
>

Re: Debug third party API library

Posted by steven liu <st...@gmail.com>.
Thanks. It works:) I need to use this because I cannot call TSDebug directly
in my third party API.

On Tue, Sep 6, 2011 at 6:52 PM, Ethan Lai <yz...@yahoo.com> wrote:

> Hi Steven,
>
> Print to stderr instead of stdout, fprintf(stderr, ...), could solve your
> question.
> However, I would suggest to use TSError() or TSDebug() with your own tag
> instead.  :)
>
> Thanks,
> -Ethan
>
>
>
> 2011/9/6 steven liu <st...@gmail.com>
>
>> Dear All,
>>
>> I am now working on a plugin which calls a third party API library. I am
>> able to use TSDebug() in plugin to print out debug infomation. But when I
>> use printf in my API, I cannot get the printing information on
>> screen/terminal. I also tried to open a file in my API and save the debug
>> info to the file. But I cannot find the file. The API can be called
>> properly. The only issue is that I cannot get debug information inside the
>> API. Many thanks for your help.
>>
>> Rgds,
>> Steve
>>
>>

Re: Debug third party API library

Posted by Ethan Lai <yz...@yahoo.com>.
Hi Steven,

Print to stderr instead of stdout, fprintf(stderr, ...), could solve your
question.
However, I would suggest to use TSError() or TSDebug() with your own tag
instead.  :)

Thanks,
-Ethan


2011/9/6 steven liu <st...@gmail.com>

> Dear All,
>
> I am now working on a plugin which calls a third party API library. I am
> able to use TSDebug() in plugin to print out debug infomation. But when I
> use printf in my API, I cannot get the printing information on
> screen/terminal. I also tried to open a file in my API and save the debug
> info to the file. But I cannot find the file. The API can be called
> properly. The only issue is that I cannot get debug information inside the
> API. Many thanks for your help.
>
> Rgds,
> Steve
>
> On Sat, Sep 3, 2011 at 8:56 AM, John Plevyak <jp...@acm.org> wrote:
>
> > Sorry to chime in on this so late.
> >
> > If the APIs were not already TSXXX I would have preferred to make the
> > external ones ats_
> > and the internal ts_, but now that we are already down the path I agree
> > with
> > Leif that we should
> > change all the internal apis to ats_.
> >
> > The downside is that* ink_ *can be done fast with the right hand while
> ats_
> > uses both
> > the left pinky for the 'a' and then for the _ (for me) which makes typing
> > it
> > slower :)
> >
> > john
> >
> > On Mon, Aug 29, 2011 at 5:36 AM, Leif Hedstrom <zw...@apache.org> wrote:
> >
> > > On Aug 29, 2011, at 5:03 AM, Igor Galić <i....@brainsware.org>
> wrote:
> > >
> > > >
> > > >
> > > > ----- Original Message -----
> > > >> Hi all,
> > > >>
> > > >> I'd like to propose that we start using ats_ as a prefix for new
> APIs
> > > >> (and rewrites etc.) in the internal code. Long term, we probably
> > > >
> > > > Can you please break down for us what exactly internal code is.
> > >
> > > Anything that is not external / public API.
> > >
> > > >
> > > >> should
> > > >> migrate existing ink_ prefixes to ats_, and perhaps also consider
> > > >> using
> > > >> C++ name spaces.  My rationale for using "ats" instead "ts" in the
> > > >
> > > > So this is - in the long term, going to be more than a
> > > >
> > > >  sed -i 's/\bink_/ats_/g' **/*.cc **/*.[ch]
> > >
> > > Maybe. The prefix ink just doesn't make sense in Apache.
> > >
> > > >
> > > >> internal (core) code is to make it easily distinguishable from the
> > > >> public APIs (which are all prefix e.g. TS or ts). This is very
> useful
> > > >> when grepping through the code IMO.
> > > >
> > > > Just have to teach people *how* to grep ;)
> > > >
> > > > igalic@tynix ~/src/asf/trafficserver (svn)-[trunk:1162727] %
> ack-grep
> > > '\bink_'  | wc -l
> > > > 8333
> > > > igalic@tynix ~/src/asf/trafficserver (svn)-[trunk:1162727] %
> ack-grep
> > > 'ink_'  | wc -l
> > > > 8540
> > > > igalic@tynix ~/src/asf/trafficserver (svn)-[trunk:1162727] %
> > >
> > >
> > > Ya, but if we change ink to ts, this would now find both public APIs
> and
> > > code, and the core code. The message was not really about whether we
> > should
> > > keep ink or not, I think that's a given, it's whether it should be ts
> or
> > > ats. And I'd prefer ats myself.
> > >
> > > -- Leif
> > >
> > > >
> > > >> Cheers,
> > > >>
> > > >> -- Leif
> > > >
> > > >
> > > > So long,
> > > >
> > > > i
> > > >
> > > > --
> > > > Igor Galić
> > > >
> > > > Tel: +43 (0) 664 886 22 883
> > > > Mail: i.galic@brainsware.org
> > > > URL: http://brainsware.org/
> > > > GPG: 571B 8B8A FC97 266D BDA3  EF6F 43AD 80A4 5779 3257
> > >
> >
>