ergo-services / ergo

An actor-based Framework with network transparency for creating event-driven architecture in Golang. Inspired by Erlang. Zero dependencies.
https://docs.ergo.services
MIT License
3.67k stars 143 forks source link

introduce the ergoDebug #125

Closed leonlee2013 closed 1 year ago

leonlee2013 commented 1 year ago

Print out goroutine id, line number, file name, function name for better code debugging.

halturin commented 1 year ago

May I ask you to provide an example of debug output?

leonlee2013 commented 1 year ago

Example of debugging output:

$ ./go_node1  -ergo.trace  

to stop press Ctrl-C
2022/12/05 18:45:26 [go_node1@127.0.0.1] CORE registering process: <3FA645AA.0.1001>
2022/12/05 18:45:26 [go_node1@127.0.0.1] CORE spawn a new process <3FA645AA.0.1001> (registered name: "")
2022/12/05 18:45:26 [go_node1@127.0.0.1] CORE registering name (<3FA645AA.0.1002>): system_app_sup
2022/12/05 18:45:26 [go_node1@127.0.0.1] CORE registering process: <3FA645AA.0.1002>
2022/12/05 18:45:26 [go_node1@127.0.0.1] CORE spawn a new process <3FA645AA.0.1002> (registered name: "system_app_sup")
2022/12/05 18:45:26 [go_node1@127.0.0.1] SUPERVISOR "system_app_sup" with restart strategy: one_for_one[permanent] 
2022/12/05 18:45:26 [go_node1@127.0.0.1] CORE registering name (<3FA645AA.0.1003>): system_metrics
$ ./go_node1 -ergo.debug  -ergo.trace 
2022/12/05 18:46:01 <Go#1>@core.go:402 node.(*core).newProcess [go_node1@127.0.0.1] CORE registering process: <3FA645AA.0.1002>
2022/12/05 18:46:01 <Go#1>@core.go:450 node.(*core).spawn [go_node1@127.0.0.1] CORE spawn a new process <3FA645AA.0.1002> (registered name: "system_app_sup")
2022/12/05 18:46:01 <Go#1>@supervisor.go:120 gen.(*Supervisor).ProcessInit [go_node1@127.0.0.1] SUPERVISOR "system_app_sup" with restart strategy: one_for_one[permanent] 
2022/12/05 18:46:01 <Go#22>@core.go:391 node.(*core).newProcess [go_node1@127.0.0.1] CORE registering name (<3FA645AA.0.1003>): system_metrics
2022/12/05 18:46:01 <Go#22>@core.go:402 node.(*core).newProcess [go_node1@127.0.0.1] CORE registering process: <3FA645AA.0.1003>
2022/12/05 18:46:01 <Go#22>@core.go:450 node.(*core).spawn [go_node1@127.0.0.1] CORE spawn a new process <3FA645AA.0.1003> (registered name: "system_metrics")
leonlee2013 commented 1 year ago

Can you merge this pull request? I need to delete my repository and refork ergo-service to easily pull a new branch from v221 for other PR.