Python: Add logging.Logger model

This commit is contained in:
Taus
2023-10-10 14:38:06 +00:00
committed by Rasmus Wriedt Larsen
parent dea61e14d1
commit 9d93afe128
2 changed files with 9 additions and 1 deletions

View File

@@ -255,8 +255,10 @@ module Stdlib {
*/
module Logger {
/** Gets a reference to the `logging.Logger` class or any subclass. */
private API::Node subclassRef() {
API::Node subclassRef() {
result = API::moduleImport("logging").getMember("Logger").getASubclass*()
or
result = ModelOutput::getATypeNode("logging.Logger~Subclass").getASubclass*()
}
/**

View File

@@ -404,6 +404,12 @@ class Urllib3PoolManager extends FindSubclassesSpec {
override API::Node getAlreadyModeledClass() { result = Urllib3::PoolManager::classRef() }
}
class StdlibLogger extends FindSubclassesSpec {
StdlibLogger() { this = "logging.Logger~Subclass" }
override API::Node getAlreadyModeledClass() { result = Stdlib::Logger::subclassRef() }
}
bindingset[fullyQualified]
predicate fullyQualifiedToYamlFormat(string fullyQualified, string type2, string path) {
exists(int firstDot | firstDot = fullyQualified.indexOf(".", 0, 0) |