X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 09 Nov 2011 11:54 AM by  anon
journal and message,/info
 7 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
09 Nov 2011 11:54 AM
    I'm using journaling for a large data pipeline that prints out some outputs and message,/info 's some. I'd like message,/info to show up in the journal. Is there any way to do that?

    Deleted User



    New Member


    Posts:
    New Member


    --
    09 Nov 2011 12:48 PM
    I must be misunderstanding you. Why do you think it *doesn't* show up in the journal file?

    Deleted User



    New Member


    Posts:
    New Member


    --
    09 Nov 2011 12:53 PM
    MWE: IDL> journal IDL> journal,'test.txt' IDL> print,"this is a test" this is a test IDL> message,"this is a test message",/info % $MAIN$: this is a test message IDL> journal IDL> $cat test.txt ; IDL Version 8.1, Mac OS X (darwin x86_64 m64) ; Journal File for adam ; Working directory: /a/real/path/ ; Date: Wed Nov 9 12:51:01 2011 print,"this is a test" ;this is a test message,"this is a test message",/info IDL> The message command shows up in the journal, as long as I've entered it on the command line directly, but the message does not show up.

    Deleted User



    New Member


    Posts:
    New Member


    --
    09 Nov 2011 01:31 PM
    That seems like a distinction without a difference to me, but OK. Maybe you would prefer to use the ErrorLogger in my Coyote Library to store this information. As you are adding text to the file, you can optionally print it to the command line, too. You can find it here: http://www.idlcoyote.com/documents/programs.php

    Deleted User



    New Member


    Posts:
    New Member


    --
    09 Nov 2011 02:16 PM
    I think the distinction is quite significant. I never use 'message' on the command line except in the above MWE. I frequently use it in code so that it prints out what procedure it has been called from and can be set to either info=1 to deliver a message or info=0 to insert a breakpoint. While ErrorLogger is feature-rich, I don't want to have to change all of my code to redirect to a logger when journal already exists. My simple work-around, which is trivial but still undesirable as it requires changing many calls to the command, is this: pro mymessage,msg,_extra=_extra printf,!journal,msg message,msg,_extra=_extra end Is there perhaps a way to overload the IDL message command with the above?

    Deleted User



    New Member


    Posts:
    New Member


    --
    09 Nov 2011 05:08 PM
    The simple workaround I suggested does not work because the context from which it is printed is alway mymessage.

    Deleted User



    New Member


    Posts:
    New Member


    --
    09 Nov 2011 07:44 PM
    You can get the name of the calling routine like this: Help, Calls=callStack callingRoutine = (StrSplit(StrCompress(callStack[1])," ", /Extract))[0] (I got this out of the very useful Error_Message() routine from my library.) But, you are still going to have to rewrite your code to add your own message utility. It is no harder to use something that is already built and working correctly. :-) Adding the calling routine to the text added to the ErrorLogger is probably a good idea. I've just modified the code to do that if the Add_Caller keyword is set when the AddText method is called. I'm just off to play tennis now, but I'll check this into the Coyote Library in the morning.

    Deleted User



    New Member


    Posts:
    New Member


    --
    09 Nov 2011 07:53 PM
    That's essentially the solution I came up with - turns out I don't really want 'message', I just want to know the calling program. It's still frustrating that I have to replace every 'message' call with 'mymessage' if I want this to work. I will consider using ErrorLogger for other work now that I know it will have that added feature. ; mymessage acts like message but only accepts the /info keyword and will be recorded in journals pro mymessage,msg,info=info help,calls=callstack proc_name = (strsplit(callstack[1],/extract))[0] fullmsg = "% "+proc_name+": "+msg print,fullmsg if ~keyword_set(info) then stop end
    You are not authorized to post a reply.