LSST Applications g0265f82a02+0e5473021a,g02d81e74bb+bd2ed33bd6,g1470d8bcf6+de7501a2e0,g14a832a312+ff425fae3c,g2079a07aa2+86d27d4dc4,g2305ad1205+91a32aca49,g295015adf3+762506a1ad,g2bbee38e9b+0e5473021a,g337abbeb29+0e5473021a,g3ddfee87b4+c34e8be1fa,g487adcacf7+5fae3daba8,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+ea1711114f,g5a732f18d5+53520f316c,g64a986408d+bd2ed33bd6,g858d7b2824+bd2ed33bd6,g8a8a8dda67+585e252eca,g99cad8db69+016a06b37a,g9ddcbc5298+9a081db1e4,ga1e77700b3+15fc3df1f7,ga8c6da7877+ef4e3a5875,gb0e22166c9+60f28cb32d,gb6a65358fc+0e5473021a,gba4ed39666+c2a2e4ac27,gbb8dafda3b+09e12c87ab,gc120e1dc64+bc2e06c061,gc28159a63d+0e5473021a,gcf0d15dbbd+c34e8be1fa,gdaeeff99f8+f9a426f77a,ge6526c86ff+508d0e0a30,ge79ae78c31+0e5473021a,gee10cc3b42+585e252eca,gf18bd8381d+8d59551888,gf1cff7945b+bd2ed33bd6,w.2024.16
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | List of all members
lsst.log.log.logContinued.Log Class Reference

Public Member Functions

 usePythonLogging (cls)
 
 doNotUsePythonLogging (cls)
 
 name (self)
 
 level (self)
 
 parent (self)
 
 trace (self, fmt, *args)
 
 debug (self, fmt, *args)
 
 info (self, fmt, *args)
 
 warn (self, fmt, *args)
 
 warning (self, fmt, *args)
 
 error (self, fmt, *args)
 
 fatal (self, fmt, *args)
 
 critical (self, fmt, *args)
 
 __reduce__ (self)
 
 __repr__ (self)
 

Public Attributes

 UsePythonLogging
 

Static Public Attributes

bool UsePythonLogging = False
 
 CRITICAL = CRITICAL
 
 WARNING = WARNING
 

Protected Member Functions

 _log (self, level, use_format, fmt, *args, **kwargs)
 

Detailed Description

Definition at line 56 of file logContinued.py.

Member Function Documentation

◆ __reduce__()

lsst.log.log.logContinued.Log.__reduce__ ( self)
Implement pickle support.

Definition at line 161 of file logContinued.py.

161 def __reduce__(self):
162 """Implement pickle support.
163 """
164 args = (self.getName(), )
165 # method has to be module-level, not class method
166 return (getLogger, args)
167

◆ __repr__()

lsst.log.log.logContinued.Log.__repr__ ( self)

Definition at line 168 of file logContinued.py.

168 def __repr__(self):
169 # Match python logging style.
170 cls = type(self)
171 class_name = f"{cls.__module__}.{cls.__qualname__}"
172 prefix = "lsst.log.log.log"
173 if class_name.startswith(prefix):
174 class_name = class_name.replace(prefix, "lsst.log")
175 return f"<{class_name} '{self.name}' ({getLevelName(self.getEffectiveLevel())})>"
176
177

◆ _log()

lsst.log.log.logContinued.Log._log ( self,
level,
use_format,
fmt,
* args,
** kwargs )
protected

Definition at line 134 of file logContinued.py.

134 def _log(self, level, use_format, fmt, *args, **kwargs):
135 if self.isEnabledFor(level):
136 frame = inspect.currentframe().f_back # calling method
137 frame = frame.f_back # original log location
138 filename = os.path.split(frame.f_code.co_filename)[1]
139 funcname = frame.f_code.co_name
140 if use_format:
141 msg = fmt.format(*args, **kwargs) if args or kwargs else fmt
142 else:
143 msg = fmt % args if args else fmt
144 if self.UsePythonLogging:
145 levelno = LevelTranslator.lsstLog2logging(level)
146 levelName = logging.getLevelName(levelno)
147
148 pylog = logging.getLogger(self.getName())
149 record = logging.makeLogRecord(dict(name=self.getName(),
150 levelno=levelno,
151 levelname=levelName,
152 msg=msg,
153 funcName=funcname,
154 filename=filename,
155 pathname=frame.f_code.co_filename,
156 lineno=frame.f_lineno))
157 pylog.handle(record)
158 else:
159 self.logMsg(level, filename, funcname, frame.f_lineno, msg)
160

◆ critical()

lsst.log.log.logContinued.Log.critical ( self,
fmt,
* args )

Definition at line 129 of file logContinued.py.

129 def critical(self, fmt, *args):
130 # Do not call fatal() because that will result in an incorrect
131 # line number in the log.
132 self._log(Log.FATAL, False, fmt, *args)
133

◆ debug()

lsst.log.log.logContinued.Log.debug ( self,
fmt,
* args )

Definition at line 109 of file logContinued.py.

109 def debug(self, fmt, *args):
110 self._log(Log.DEBUG, False, fmt, *args)
111

◆ doNotUsePythonLogging()

lsst.log.log.logContinued.Log.doNotUsePythonLogging ( cls)
Forward log messages to LSST logging system.

Notes
-----
This is the default state.

Definition at line 79 of file logContinued.py.

79 def doNotUsePythonLogging(cls):
80 """Forward log messages to LSST logging system.
81
82 Notes
83 -----
84 This is the default state.
85 """
86 cls.UsePythonLogging = False
87

◆ error()

lsst.log.log.logContinued.Log.error ( self,
fmt,
* args )

Definition at line 123 of file logContinued.py.

123 def error(self, fmt, *args):
124 self._log(Log.ERROR, False, fmt, *args)
125

◆ fatal()

lsst.log.log.logContinued.Log.fatal ( self,
fmt,
* args )

Definition at line 126 of file logContinued.py.

126 def fatal(self, fmt, *args):
127 self._log(Log.FATAL, False, fmt, *args)
128

◆ info()

lsst.log.log.logContinued.Log.info ( self,
fmt,
* args )

Definition at line 112 of file logContinued.py.

112 def info(self, fmt, *args):
113 self._log(Log.INFO, False, fmt, *args)
114

◆ level()

lsst.log.log.logContinued.Log.level ( self)

Definition at line 93 of file logContinued.py.

93 def level(self):
94 return self.getLevel()
95

◆ name()

lsst.log.log.logContinued.Log.name ( self)

Definition at line 89 of file logContinued.py.

89 def name(self):
90 return self.getName()
91
table::Key< std::string > name
Definition Amplifier.cc:116

◆ parent()

lsst.log.log.logContinued.Log.parent ( self)
Returns the parent logger, or None if this is the root logger.

Definition at line 97 of file logContinued.py.

97 def parent(self):
98 """Returns the parent logger, or None if this is the root logger."""
99 if not self.name:
100 return None
101 parent_name = self.name.rpartition(".")[0]
102 if not parent_name:
103 return self.getDefaultLogger()
104 return self.getLogger(parent_name)
105

◆ trace()

lsst.log.log.logContinued.Log.trace ( self,
fmt,
* args )

Definition at line 106 of file logContinued.py.

106 def trace(self, fmt, *args):
107 self._log(Log.TRACE, False, fmt, *args)
108

◆ usePythonLogging()

lsst.log.log.logContinued.Log.usePythonLogging ( cls)
Forward log messages to Python `logging`

Notes
-----
This is useful for unit testing when you want to ensure
that log messages are captured by the testing environment
as distinct from standard output.

This state only affects messages sent to the `lsst.log`
package from Python.

Definition at line 64 of file logContinued.py.

64 def usePythonLogging(cls):
65 """Forward log messages to Python `logging`
66
67 Notes
68 -----
69 This is useful for unit testing when you want to ensure
70 that log messages are captured by the testing environment
71 as distinct from standard output.
72
73 This state only affects messages sent to the `lsst.log`
74 package from Python.
75 """
76 cls.UsePythonLogging = True
77

◆ warn()

lsst.log.log.logContinued.Log.warn ( self,
fmt,
* args )

Definition at line 115 of file logContinued.py.

115 def warn(self, fmt, *args):
116 self._log(Log.WARN, False, fmt, *args)
117

◆ warning()

lsst.log.log.logContinued.Log.warning ( self,
fmt,
* args )

Definition at line 118 of file logContinued.py.

118 def warning(self, fmt, *args):
119 # Do not call warn() because that will result in an incorrect
120 # line number in the log.
121 self._log(Log.WARN, False, fmt, *args)
122

Member Data Documentation

◆ CRITICAL

lsst.log.log.logContinued.Log.CRITICAL = CRITICAL
static

Definition at line 60 of file logContinued.py.

◆ UsePythonLogging [1/2]

bool lsst.log.log.logContinued.Log.UsePythonLogging = False
static

Definition at line 57 of file logContinued.py.

◆ UsePythonLogging [2/2]

lsst.log.log.logContinued.Log.UsePythonLogging

Definition at line 76 of file logContinued.py.

◆ WARNING

lsst.log.log.logContinued.Log.WARNING = WARNING
static

Definition at line 61 of file logContinued.py.


The documentation for this class was generated from the following file: