Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor vicky_nits's Avatar
    Join Date
    Oct 2009
    Posts
    314
    Hi I need a good logic as to how implement indentation in my log file that i am creating for my application.

    Suppose I have three functions like M1,M2,M3 and M2 is called from M1 and M3 from M2

    M1->M2->M3

    Now in my log file I want something like this

    Code:
     >>>M1
            >>>M2
                   >>>M3
                   <<<M3
           <<<M2
    <<<M1
    Can anyone help me with some logic. I guess i have to deal with spaces

  2. #2
    Nokia Developer Moderator wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Mallorca, Holiday
    Posts
    27,683
    You could have a variable in your logger object for counting indentation level, and provide some methods for increasing/decreasing it.
    Or store indentation locally, in the methods (and pass it as an argument to the logger).
    Perhaps in a local object residing on the stack - thus its destructor could automatically log when the method is left.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved