hyperjumptech/grule-rule-engine

Variable logs not using new logger configured by logger.SetLogger

pasendra opened this issue · 4 comments

Each package initialize a Logger with a global variable like this:
image

The issue is, when you use the grule-rule-engine library, you probably have to do multiples imports. If you decide to change the logger.SetLogger, you are changing to a Logger instance which is not even used by the packages already imported, because these packages when are imported, all global vars are resolved. So log var is pointing to an old Logger instance which is never updated to the one changed by logger.SetLogger.

It must be taken into account that although you can call the SetLogger of each imported package, these packages also import dependencies that could also require calling the SetLogger of each one of them, which is very cumbersome to know all the SetLogger a which one must have to call to change the logger of the entire library. Calling logger.SetLogger should affect all loggers in all packages, or at least, that's the behavior I would expect.

kunalh commented

@pasendra - Need small help , enable to install Grrule

I am trying to install grule-rule-engine , following below steps.. were you able to install on your machine?

go version
go version go1.20.3 darwin/arm64

go install github.com/hyperjumptech/grule-rule-engine@latest

getting below error

go: github.com/hyperjumptech/grule-rule-engine@latest: module github.com/hyperjumptech/grule-rule-engine@latest found (v1.13.0), but does not contain package github.com/hyperjumptech/grule-rule-engine

Do let me know incase more details are required

@kunalh did you try go clean command? Please use a new issue so we don't stray off topic.

I am also interested to see the answer to above issue posted by @pasendra