0 Replies Latest reply on Feb 21, 2011 8:33 AM by DFBurns

    Gotcha with LrLogger

    DFBurns

      Documenting this gotcha for the benefit of any others who run into this like I did:

       

      Don't know if this is true on Mac as well but in my environment (Windows 7 and Lr 3.3), when an instance of LrLogger is enabled with 'print' instead of 'logfile', Lightroom will only output up to the first newline. So, if you do this:

       

      myLogger:enable( 'logfile' )

      myLogger:trace( 'Line 1\nLine2' )

       

      you will see both lines in your log file as expected. But if you do this:

       

      myLogger:enable( 'print' )

      myLogger:trace( 'Line 1\nLine2' )

       

      you will only see 'Line 1' in your output stream. Lr seems to truncate the output string after the first newline.

       

      I don't see this documented anywhere in the SDK doc. My workaround is to have a logging wrapper function that takes the input string, splits it on the newlines into an array, then call the trace function once for each array element.

       

      db