jan
January 11, 2023, 4:40pm
1
Today I found myself looking at this term in the logs.
goal_failed(swish_chat:('.'(v{anonymous_avatar:'/icons/avatar.svg#1939449',avatar:'/icons/avatar.svg#1939449',avatar_source:client},put(_12328{check_login:true,consumer:'VU',reconnect:'I0AP_7G0ZtIYumjDJdQ_8g',type:welcome,uid:'795491e4-91cc-11ed-8233-0242ac110004',visitors:218,wsid:'793d817a-91cc-11ed-bed7-0242ac110004'}),_12412),hub_send('793d817a-91cc-11ed-bed7-0242ac110004',json(_12412)))).
Pretty unreadable, no? Well, go to SWISH and run the query
A = <this huge term>
and see this nice layout. Hovering highlights subterms and clicking a functor allows for an alternative view of the subterm (collapse, horizontal, vertical or smart (automatic, default)).
8 Likes
And for those (like me) who live in emacs, print_term/2 is useful:
?- X = goal_failed(swish_chat:('.'(v{anonymous_avatar:'/icons/avatar.svg#1939449',avatar:'/icons/avatar.svg#1939449',avatar_source:client},put(_12328{check_login:true,consumer:'VU',reconnect:'I0AP_7G0ZtIYumjDJdQ_8g',type:welcome,uid:'795491e4-91cc-11ed-8233-0242ac110004',visitors:218,wsid:'793d817a-91cc-11ed-bed7-0242ac110004'}),_12412),hub_send('793d817a-91cc-11ed-bed7-0242ac110004',json(_12412)))),
| print_term(X, [tab_width(0), right_margin(60)]).
goal_failed(swish_chat : ( '.'(v{ anonymous_avatar:'/icons/avatar.svg#1939449',
avatar:'/icons/avatar.svg#1939449',
avatar_source:client
},
put(_{ check_login:true,
consumer:'VU',
reconnect:'I0AP_7G0ZtIYumjDJdQ_8g',
type:welcome,
uid:'795491e4-91cc-11ed-8233-0242ac110004',
visitors:218,
wsid:'793d817a-91cc-11ed-bed7-0242ac110004'
}),
A),
hub_send('793d817a-91cc-11ed-bed7-0242ac110004',
json(A))
))
3 Likes
toblo
January 17, 2023, 4:16am
3
That’s the kind of thing i love to see