Forum Discussion

NisHera's avatar
NisHera
Valued Contributor
9 years ago

Python Log message pointer

I have following code in python

class position:
  def __init__(self):
    # do nothing
    Log.Message("class inits")
    
  def abc(self):
    A = "ABC"
    return A    

def runme():
  positionOBJ = position()
  Log.Message(str(positionOBJ.abc()))  

when I run I got two messages

 class inits 

 ABC

 

when duble click on log result "class inits" it will higlight Log message inside class -OK

but when duble click on log results "ABC" will highlight Return statement inside class - was expecting to highlight on last line of code

 

it is a bug ?

1 Reply

  • baxatob's avatar
    baxatob
    Community Hero

    Hi,

     

    It is not a bug. When you are clicking on the log record, you are referencing to the line of source code, from where this record was created. In your case it is exactly a class function abc().

     

    Try to change your code:

     

    def runme():
      positionOBJ = position()
      log = str(positionOBJ.abc())
      Log.Message(log)  

    Now if you click on log record "ABC", the last line of your code will be highlighted.