Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

func logging(to logger: Logger) -> any Database - Not working #219

Open
adirburke opened this issue May 20, 2024 · 0 comments
Open

func logging(to logger: Logger) -> any Database - Not working #219

adirburke opened this issue May 20, 2024 · 0 comments

Comments

@adirburke
Copy link

adirburke commented May 20, 2024

let oldRW = vaporApp.db(.psql)
        var ro = vaporApp.db(.readOnly)
        
        let databaseLogger = Logger(label: "Database") { label in
            var logger = EventManager(service: "Database", eventId: UUID(), level: Logger.Level.info)
            print(label)
            logger.label = label
            return logger
        }
        
        let rw = oldRW.logging(to: databaseLogger)
        rw.logger.info("Setting New Logger rw")
        oldRW.logger.info("Setting New Logger oldRW")
        ro = ro.logging(to: databaseLogger) 

I am injecting the rw and ro databases but it is still logging to the default logger. Seems like it still logs on the default database rather then the decorated one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant