mehdihadeli / go-food-delivery-microservices

🍕 A practical and imaginary food delivery microservices, built with golang, domain-driven design, cqrs, event sourcing, vertical slice architecture, event-driven architecture, and the latest technologies.
MIT License
888 stars 92 forks source link

Use Slog logger #65

Open mehdihadeli opened 1 year ago

mehdihadeli commented 1 year ago
Alan-MQ commented 1 year ago

I wanna try this one too, but I'm not sure if I am running this project correctly~~, just run cmd/app/main.go from catalog_read_service, write_service and order_service?

Alan-MQ commented 1 year ago

And I notice we will intergate ELK to this project, so we might wanna Use Slog before we introduce ELK right? and by the way, intergate ELK need someone fully understand this project right? about how fx are working here and event driven , message queue all that stuff~~~

Alan-MQ commented 1 year ago

And I notice we will intergate ELK to this project, so we might wanna Use Slog before we introduce ELK right? and by the way, intergate ELK need someone fully understand this project right? about how fx are working here and event driven , message queue all that stuff~~~

try to run this project with this method and I got something like this image

but , when I make unit-test locally all tests passed. that means the docker enviroment was nothing wrong right?

mehdihadeli commented 1 year ago

Yes, slog is built structured logging in go 21.0, so it is better we switch to this library. Maybe we have to upgrade the project to go 21.0 at first. Maybe in a separated issue or pull request. Yes, first we should use slog after that we integrate that with ELK and kibana

mehdihadeli commented 1 year ago

And I notice we will intergate ELK to this project, so we might wanna Use Slog before we introduce ELK right? and by the way, intergate ELK need someone fully understand this project right? about how fx are working here and event driven , message queue all that stuff~~~

try to run this project with this method and I got something like this image

but , when I make unit-test locally all tests passed. that means the docker enviroment was nothing wrong right?

This is a temp docker container that use by go-testcotainer library for my integration and end-to-end tests, it should be ephemeral and after running tests it should be destroyed. 65027:27017 is a testcontainer for MongoDB. Yes, it is fine, no problem. Just some logging to destroy containers, I think so. Maybe after destroy container by testcontainer we lost the connection for mongo, and we get this error

mehdihadeli commented 1 year ago

Could you first upgrade to version 21 at first #81 ?

Alan-MQ commented 1 year ago

ok, so I will look up all this parpers you mentioned on the top , and come up with a plan about how to use slog, but at some point , I'm gonna need to run this project correctly to see the log right ? is there any doc on how should I run this project?

Alan-MQ commented 1 year ago

Could you first upgrade to version 21 at first #81 ?

sure

mehdihadeli commented 1 year ago

Thanks

mehdihadeli commented 1 year ago

For migrating to slog, you can create an abstraction like my zap abstraction. at the end all of this abstraction like zap, logrus, ... will implement logger interface and we use logger interface totally in the app

Alan-MQ commented 1 year ago

ok, I will check it out first.