# eric7.Plugins.CheckerPlugins.CodeStyleChecker.Logging.LoggingVisitor

Module implementing a node visitor to check for logging issues.

### Global Attributes

_LoggerMethods
_LogrecordAttributes

### Classes

LoggingVisitor | Class implementing a node visitor to check for logging issues.

### Functions

_modnamedPlaceholderRe | Function to generate a regular expression object for '%' formatting codes using names.
_modposPlaceholderRe | Function to generate a regular expression object for '%' formatting codes.

## LoggingVisitor

Class implementing a node visitor to check for logging issues.

### Derived from

ast.NodeVisitor

### Class Attributes

GetLoggerNames

### Class Methods

None

### Methods

LoggingVisitor | Constructor
__atModuleLevel | Private method to check, if we are on the module level.
__checkMsgAndArgs | Private method to check the message and arguments a given Call node.
__currentExceptHandler | Private method to determine the current exception handler node.
__flattenStrChain | Private method to flatten the given string chain.
__isAddChainWithNonStr | Private method to check, if the node is an Add with a non string argument.
__keywordPos | Private method determine line number and column offset of a given keyword node.
visit |
visit_Attribute | Public method to handle Attribute nodes.
visit_Call | Public method to handle Call nodes.
visit_Import | Public method to handle Import nodes.
visit_ImportFrom | Public method to handle ImportFrom nodes.

### Static Methods

None

#### LoggingVisitor (Constructor)

LoggingVisitor(errorCallback)

Constructor

errorCallback (func)
  callback function to register an error

#### LoggingVisitor.__atModuleLevel

__atModuleLevel()

Private method to check, if we are on the module level.

Return:
  flag indicating the module level

Return Type:
  bool

#### LoggingVisitor.__checkMsgAndArgs

__checkMsgAndArgs(node, msgArg, msg)

Private method to check the message and arguments a given Call node.

node (ast.Call)
  reference to the Call node
msgArg (ast.AST)
  message argument nodes
msg (str)
  message

#### LoggingVisitor.__currentExceptHandler

__currentExceptHandler()

Private method to determine the current exception handler node.

Return:
  reference to the current exception handler node or None

Return Type:
  ast.ExceptHandler

#### LoggingVisitor.__flattenStrChain

__flattenStrChain(node)

Private method to flatten the given string chain.

node (ast.AST)
  reference to the AST node

Return:
  flattened string

Return Type:
  str

#### LoggingVisitor.__isAddChainWithNonStr

__isAddChainWithNonStr(node)

Private method to check, if the node is an Add with a non string argument.

node (ast.BinOp)
  reference to the binary operator node

Return:
  flag indicating an Add with a non string argument

Return Type:
  bool

#### LoggingVisitor.__keywordPos

__keywordPos(node)

Private method determine line number and column offset of a given keyword node.

node (ast.keyword)
  reference to the keyword node

Return:
  tuple containing the line number and the column offset

Return Type:
  tuple of (int, int)

#### LoggingVisitor.visit

visit()

#### LoggingVisitor.visit_Attribute

visit_Attribute(node)

Public method to handle Attribute nodes.

node (ast.Attribute)
  reference to the node to be processed

#### LoggingVisitor.visit_Call

visit_Call(node)

Public method to handle Call nodes.

node (ast.Call)
  reference to the node to be processed

#### LoggingVisitor.visit_Import

visit_Import(node)

Public method to handle Import nodes.

node (ast.Import)
  reference to the node to be processed

#### LoggingVisitor.visit_ImportFrom

visit_ImportFrom(node)

Public method to handle ImportFrom nodes.

node (ast.ImportFrom)
  reference to the node to be processed

Up

## _modnamedPlaceholderRe

_modnamedPlaceholderRe()

Function to generate a regular expression object for '%' formatting codes using names.

Return:
  regular expression object

Return Type:
  re.Pattern

Up

## _modposPlaceholderRe

_modposPlaceholderRe()

Function to generate a regular expression object for '%' formatting codes.

Return:
  regular expression object

Return Type:
  re.Pattern

Up