[GODRIVER-2881] LogComponentAll does not enable logging Created: 27/Jun/23  Updated: 28/Oct/23  Resolved: 01/Aug/23

Status: Closed
Project: Go Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 1.12.1

Type: Bug Priority: Unknown
Reporter: Preston Vasquez Assignee: Preston Vasquez
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Documentation Changes: Not Needed
Documentation Changes Summary:

1. What would you like to communicate to the user about this feature?
2. Would you like the user to see examples of the syntax and/or executable code and its output?
3. Which versions of the driver/connector does this apply to?


 Description   

There is a logging design oversight in which enabling logging with "options.LogComponentAll" does not result in the publication of logs. This issue arises because the "LevelComponentEnabled" method on the internal logger object fails to account for this specific use case. To resolve this, it is recommended to extend the method as follows:
 

func (logger *Logger) LevelComponentEnabled(level Level, component Component) bool {
    return logger.ComponentLevels[component] >= level ||
        logger.ComponentLevels[ComponentAll] >= level
} 



 Comments   
Comment by Githook User [ 01/Aug/23 ]

Author:

{'name': 'Preston Vasquez', 'email': 'prestonvasquez@icloud.com', 'username': 'prestonvasquez'}

Message: GODRIVER-2881 Enable logging for ComponentAll (#1340)
Branch: release/1.12
https://github.com/mongodb/mongo-go-driver/commit/d219098916140466493fcca942a98b51582e32ca

Comment by Githook User [ 01/Aug/23 ]

Author:

{'name': 'Preston Vasquez', 'email': 'prestonvasquez@icloud.com', 'username': 'prestonvasquez'}

Message: GODRIVER-2881 Enable logging for ComponentAll (#1340)
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/14306629058485de0736f05e970a56a4a5dc9c43

Generated at Thu Feb 08 08:39:34 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.