Non-wrapping rigid body rotations?
Matrices store rotations as quaternions (to_euler is only a method converting them), so if you get your data from a matrix, you know you lost information about the number of rotations. I don't think there's a way to read the euler values.
However, because 360° range is quite big, as long as your object is rotating slower than 180° per frame (or per simulation step, if you know how to access data in simulation process), you can remember previous rotation, get current rotation, and check the difference. A big (&gt; 180°) difference suggests wrapping occurred, so you can unwrap the value, and add the difference to a variable that stores the real rotation.
rotation = deg(rotating_object.matrix_world.to_euler()[0])
difference = rotation - prev_rotation
if abs(difference) &gt; 180:
    difference += 360 if prev_rotation &gt; 0 else -360
    
real_rotation += difference
prev_rotation = rotation


Full code:
&quot;&quot;&quot;
Type in console:
mod = D.texts['drawhandler.py'].as_module()
mod.register()
&quot;&quot;&quot;

import bpy
from math import degrees as deg

view_handler = None
objects = bpy.data.objects
c = objects['Cylinder']
t = objects['Text']
prev_rotation = 0
real_rotation = 0


def callback():
    global prev_rotation
    global real_rotation
    
    rotation = deg(c.matrix_world.to_euler()[0])
    difference = rotation - prev_rotation
    if abs(difference) &gt; 180:
        # rotation += 360 if prev_rotation &gt; 0 else -360
        # difference = rotation - prev_rotation
        # shortcut:
        difference += 360 if prev_rotation &gt; 0 else -360
        
    real_rotation += difference
    prev_rotation = rotation
        
    t.data.body = str(int(real_rotation))



def register():
    global view_handler
    view_handler = bpy.types.SpaceView3D.draw_handler_add(callback, (), 'WINDOW', 'PRE_VIEW') 
    

def unregister():
    bpy.types.SpaceView3D.draw_handler_remove(view_handler, 'WINDOW')  # remove handler added on end of register() function


if __name__ == &quot;__main__&quot;:
    register()

You probably want to use a driver instead of a dirty draw handler.