|
def | catch (self, msg, func, *args, **kargs) |
|
def | catchLog (self, msg, func, *args, **kargs) |
|
def | catchMsg (self, msg, func, *args, **kargs) |
|
def | catchTrace (self, msg, func, *args, **kargs) |
|
def | catchWarn (self, msg, func, *args, **kargs) |
|
def | error (self, msg, *args, **kargs) |
|
def | isEnabledFor (self, level) |
|
def | log (self, msg, *args, **kargs) |
|
def | msg (self, msg, *args, **kargs) |
|
def | report (self, msg, func, *args, **kargs) |
|
def | trace (self, msg, *args, **kargs) |
|
def | warn (self, msg, *args, **kargs) |
|
Convenient class for tagged logging.
Example usage:
>>> logger = FreeCAD.Logger('MyModule')
>>> logger.info('log test {}',1)
24.36053 <MyModule> <input>(1): test log 1
The default output format is:
<timestamp> <tag> <source file>(line number): message
The message is formatted using new style Python string formatting, e.g.
'test {}'.format(1). It is strongly recommended to not directly use
Python string formatting, but pass additional argument indirectly through
various logger print function, because the logger can skip string
evaluation in case the logging level is disabled. For more options,
please consult the docstring of __init__(), catch() and report().
To set/get logger level:
>>> FreeCAD.setLogLevel('MyModule','Trace')
>>> FreeCAD.getLogLevel('MyModule')
4
There are five predefined logger level, each corresponding to an integer
value, as shown below together with the corresponding logger print
method,
0: Error, Logger.error()
1: Warning, Logger.warn()
2: Message, Logger.msg() or info()
3: Log, Logger.log() or debug()
4: Trace, Logger.trace()
FreeCAD.setLogLevel() supports both text and integer value, which allows
you to define your own levels. The level set is persisted to user
configuration file.
By default any tag has a log level of 2 for release, and 3 for debug
build.
def FreeCADInit.FCADLogger.error |
( |
|
self, |
|
|
|
msg, |
|
|
* |
args, |
|
|
** |
kargs |
|
) |
| |
"Error" level log printer
* msg: message string. May contain new style Python string formatter.
This function accepts additional positional and keyword arguments,
which are forward to string.format() to generate the logging
message. It is strongly recommended to not directly use Python
string formatting, but pass additional arguments here, because the
printer can skip string evaluation in case the logging level is
disabled.
References FreeCADInit.FCADLogger._isEnabledFor(), and FreeCADInit.FCADLogger._log().
Referenced by femmesh.gmshtools.GmshTools.read_and_set_new_mesh(), FreeCADInit.FCADLogger.report(), and femmesh.gmshtools.GmshTools.run_gmsh_with_geo().
def FreeCADInit.FCADLogger.log |
( |
|
self, |
|
|
|
msg, |
|
|
* |
args, |
|
|
** |
kargs |
|
) |
| |
"Log" level log printer
* msg: message string. May contain new style Python string formatter.
This function accepts additional positional and keyword arguments,
which are forward to string.format() to generate the logging
message. It is strongly recommended to not directly use Python
string formatting, but pass additional arguments here, because the
printer can skip string evaluation in case the logging level is
disabled.
References FreeCADInit.FCADLogger._isEnabledFor(), and FreeCADInit.FCADLogger._log().
def FreeCADInit.FCADLogger.msg |
( |
|
self, |
|
|
|
msg, |
|
|
* |
args, |
|
|
** |
kargs |
|
) |
| |
"Message" level log printer
* msg: message string. May contain new style Python string formatter.
This function accepts additional positional and keyword arguments,
which are forward to string.format() to generate the logging
message. It is strongly recommended to not directly use Python
string formatting, but pass additional arguments here, because the
printer can skip string evaluation in case the logging level is
disabled.
References FreeCADInit.FCADLogger._isEnabledFor(), and FreeCADInit.FCADLogger._log().
def FreeCADInit.FCADLogger.report |
( |
|
self, |
|
|
|
msg, |
|
|
|
func, |
|
|
* |
args, |
|
|
** |
kargs |
|
) |
| |
Catch any exception report it with a message box.
* msg: message string. Unlike log printer, this argument must not
contain any string formatter.
* func: a callable object
* args: tuple of positional arguments to be passed to func.
* kargs: dictionary of keyword arguments to be passed to func.
References Gui::GraphvizWorker.error(), Gui::GraphvizView.error(), Gui::PythonConsoleP.error, femmesh.gmshtools.GmshTools.error, Attacher::SuggestResult.error, PartGui::ResultEntry.error, KDL::SolverI.error, GCS::Constraint.error(), GCS::ConstraintEqual.error(), GCS::ConstraintDifference.error(), GCS::ConstraintP2PDistance.error(), GCS::ConstraintP2PAngle.error(), GCS::ConstraintP2LDistance.error(), GCS::ConstraintPointOnLine.error(), GCS::ConstraintPointOnPerpBisector.error(), GCS::ConstraintParallel.error(), GCS::ConstraintPerpendicular.error(), GCS::ConstraintL2LAngle.error(), GCS::ConstraintMidpointOnLine.error(), GCS::ConstraintTangentCircumf.error(), GCS::ConstraintPointOnEllipse.error(), GCS::ConstraintEllipseTangentLine.error(), GCS::ConstraintInternalAlignmentPoint2Ellipse.error(), GCS::ConstraintInternalAlignmentPoint2Hyperbola.error(), GCS::ConstraintEqualMajorAxesConic.error(), GCS::ConstraintEqualFocalDistance.error(), GCS::ConstraintCurveValue.error(), GCS::ConstraintPointOnHyperbola.error(), GCS::ConstraintPointOnParabola.error(), GCS::ConstraintAngleViaPoint.error(), GCS::ConstraintSnell.error(), GCS::ConstraintEqualLineLength.error(), GCS::SubSystem.error(), SMESH_File.error(), e57::E57XmlParser.error(), MetadataInternal::XMLErrorHandler.error(), DOMTreeErrorReporter.error(), _QuadFaceGrid.error(), VISCOUS_2D::_ViscousBuilder2D.error(), VISCOUS_3D::_ViscousBuilder.error(), Base::XMLReader.error(), SMESH_Algo.error(), StdMeshers_PrismAsBlock.error(), Gui::Dialog::DownloadItem.error(), femsolver.report.Report.error(), FreeCADInit.FCADLogger.error(), ArchAxis._AxisTaskPanel.title, ArchAxisSystem.AxisSystemTaskPanel.title, ArchComponent.ComponentTaskPanel.title, ArchCutPlane._CutPlaneTaskPanel.title, ArchGrid.ArchGridTaskPanel.title, ArchRoof._RoofTaskPanel.title, ArchSectionPlane.SectionPlaneTaskPanel.title, ArchWindow._ArchWindowTaskPanel.title, DraftGui.DraftToolBar.title, DraftGui.FacebinderTaskPanel.title, DrawingGui::OrthoViews.title, ifc2x3.ifcclassificationitem.title, Mod.PartDesign.WizardShaft.ShaftDiagram.Diagram.title, PathScripts.PathOpGui.TaskPanelPage.title, PathScripts.PathToolBitLibraryGui.ToolBitSelector.title, PathScripts.PathToolBitLibraryGui.ToolBitLibrary.title, TaskPanel.TaskWatcher.title, and TaskPanel.TaskWatcherFilter.title.
Referenced by femsolver.run.Check.check_geos_beamsection_and_shellthickness(), femsolver.run.Check.check_geos_beamsection_no(), femsolver.run.Check.check_geos_beamsection_single(), femsolver.run.Check.check_geos_shellthickness_no(), femsolver.run.Check.check_geos_shellthickness_single(), femsolver.run.Check.check_material_exists(), femsolver.run.Check.check_material_single(), femsolver.run.Check.check_mesh_exists(), femsolver.elmer.tasks.Check.checkEquations(), femsolver.elmer.tasks.Prepare.checkHandled(), femsolver.elmer.tasks.Check.checkMeshType(), femsolver.run.Check.checkSupported(), femsolver.calculix.tasks.Check.run(), femsolver.elmer.tasks.Prepare.run(), femsolver.elmer.tasks.Solve.run(), femsolver.elmer.tasks.Results.run(), femsolver.run.Machine.run(), and femsolver.task.Task.start().
def FreeCADInit.FCADLogger.trace |
( |
|
self, |
|
|
|
msg, |
|
|
* |
args, |
|
|
** |
kargs |
|
) |
| |
"Trace" level log printer
* msg: message string. May contain new style Python string formatter.
This function accepts additional positional and keyword arguments,
which are forward to string.format() to generate the logging
message. It is strongly recommended to not directly use Python
string formatting, but pass additional arguments here, because the
printer can skip string evaluation in case the logging level is
disabled.
References FreeCADInit.FCADLogger._isEnabledFor(), FreeCADInit.FCADLogger._log(), FreeCADInit.FCADLogger.laststamp, FreeCADInit.FCADLogger.tag, App::Metadata.tag(), Base::LogLevel.tag, ArchPanel.PanelCut.tag, Dice3DS.dom3ds.ErrorChunk.tag, Dice3DS.dom3ds.M3DMAGIC.tag, Dice3DS.dom3ds.M3D_VERSION.tag, Dice3DS.dom3ds.MDATA.tag, Dice3DS.dom3ds.MESH_VERSION.tag, Dice3DS.dom3ds.MARKER.tag, Dice3DS.dom3ds.COLOR_F.tag, Dice3DS.dom3ds.COLOR_24.tag, Dice3DS.dom3ds.LIN_COLOR_24.tag, Dice3DS.dom3ds.LIN_COLOR_F.tag, Dice3DS.dom3ds.INT_PERCENTAGE.tag, Dice3DS.dom3ds.FLOAT_PERCENTAGE.tag, Dice3DS.dom3ds.MASTER_SCALE.tag, Dice3DS.dom3ds.BIT_MAP.tag, Dice3DS.dom3ds.USE_BIT_MAP.tag, Dice3DS.dom3ds.SOLID_BGND.tag, Dice3DS.dom3ds.USE_SOLID_BGND.tag, Dice3DS.dom3ds.V_GRADIENT.tag, Dice3DS.dom3ds.USE_V_GRADIENT.tag, Dice3DS.dom3ds.LO_SHADOW_BIAS.tag, Dice3DS.dom3ds.HI_SHADOW_BIAS.tag, Dice3DS.dom3ds.SHADOW_MAP_SIZE.tag, Dice3DS.dom3ds.SHADOW_SAMPLES.tag, Dice3DS.dom3ds.SHADOW_RANGE.tag, Dice3DS.dom3ds.SHADOW_FILTER.tag, Dice3DS.dom3ds.RAW_BIAS.tag, Dice3DS.dom3ds.O_CONSTS.tag, Dice3DS.dom3ds.AMBIENT_LIGHT.tag, Dice3DS.dom3ds.FOG.tag, Dice3DS.dom3ds.USE_FOG.tag, Dice3DS.dom3ds.FOG_BGND.tag, Dice3DS.dom3ds.DISTANCE_CUE.tag, Dice3DS.dom3ds.USE_DISTANCE_CUE.tag, Dice3DS.dom3ds.LAYER_FOG.tag, Dice3DS.dom3ds.USE_LAYER_FOG.tag, Dice3DS.dom3ds.DCUE_BGND.tag, Dice3DS.dom3ds.DEFAULT_VIEW.tag, Dice3DS.dom3ds.VIEW_TOP.tag, Dice3DS.dom3ds.VIEW_BOTTOM.tag, Dice3DS.dom3ds.VIEW_LEFT.tag, Dice3DS.dom3ds.VIEW_RIGHT.tag, Dice3DS.dom3ds.VIEW_FRONT.tag, Dice3DS.dom3ds.VIEW_BACK.tag, Dice3DS.dom3ds.VIEW_USER.tag, Dice3DS.dom3ds.VIEW_CAMERA.tag, Dice3DS.dom3ds.VIEW_WINDOW.tag, Dice3DS.dom3ds.NAMED_OBJECT.tag, Dice3DS.dom3ds.OBJ_HIDDEN.tag, Dice3DS.dom3ds.OBJ_VIS_LOFTER.tag, Dice3DS.dom3ds.OBJ_DOESNT_CAST.tag, Dice3DS.dom3ds.OBJ_MATTE.tag, Dice3DS.dom3ds.OBJ_FAST.tag, Dice3DS.dom3ds.OBJ_PROCEDURAL.tag, Dice3DS.dom3ds.OBJ_FROZEN.tag, Dice3DS.dom3ds.OBJ_DONT_RCVSHADOW.tag, Dice3DS.dom3ds.N_TRI_OBJECT.tag, Dice3DS.dom3ds.POINT_ARRAY.tag, Dice3DS.dom3ds.POINT_FLAG_ARRAY.tag, Dice3DS.dom3ds.FACE_ARRAY.tag, Dice3DS.dom3ds.MSH_MAT_GROUP.tag, Dice3DS.dom3ds.TEX_VERTS.tag, Dice3DS.dom3ds.SMOOTH_GROUP.tag, Dice3DS.dom3ds.MESH_MATRIX.tag, Dice3DS.dom3ds.MESH_COLOR.tag, Dice3DS.dom3ds.MESH_TEXTURE_INFO.tag, Dice3DS.dom3ds.PROC_NAME.tag, Dice3DS.dom3ds.PROC_DATA.tag, Dice3DS.dom3ds.MSH_BOXMAP.tag, Dice3DS.dom3ds.N_DIRECT_LIGHT.tag, Dice3DS.dom3ds.DL_SPOTLIGHT.tag, Dice3DS.dom3ds.DL_OFF.tag, Dice3DS.dom3ds.DL_ATTENUATE.tag, Dice3DS.dom3ds.DL_RAYSHADE.tag, Dice3DS.dom3ds.DL_SHADOWED.tag, Dice3DS.dom3ds.DL_LOCAL_SHADOW2.tag, Dice3DS.dom3ds.DL_SEE_CONE.tag, Dice3DS.dom3ds.DL_SPOT_RECTANGULAR.tag, Dice3DS.dom3ds.DL_SPOT_OVERSHOOT.tag, Dice3DS.dom3ds.DL_SPOT_PROJECTOR.tag, Dice3DS.dom3ds.DL_EXCLUDE.tag, Dice3DS.dom3ds.DL_SPOT_ROLL.tag, Dice3DS.dom3ds.DL_SPOT_ASPECT.tag, Dice3DS.dom3ds.DL_RAY_BIAS.tag, Dice3DS.dom3ds.DL_INNER_RANGE.tag, Dice3DS.dom3ds.DL_OUTER_RANGE.tag, Dice3DS.dom3ds.DL_MULTIPLIER.tag, Dice3DS.dom3ds.N_CAMERA.tag, Dice3DS.dom3ds.CAM_SEE_CONE.tag, Dice3DS.dom3ds.CAM_RANGES.tag, Dice3DS.dom3ds.VIEWPORT_LAYOUT.tag, Dice3DS.dom3ds.VIEWPORT_DATA.tag, Dice3DS.dom3ds.VIEWPORT_DATA_3.tag, Dice3DS.dom3ds.VIEWPORT_SIZE.tag, Dice3DS.dom3ds.NETWORK_VIEW.tag, Dice3DS.dom3ds.MAT_NAME.tag, Dice3DS.dom3ds.MAT_AMBIENT.tag, Dice3DS.dom3ds.MAT_DIFFUSE.tag, Dice3DS.dom3ds.MAT_SPECULAR.tag, Dice3DS.dom3ds.MAT_SHININESS.tag, Dice3DS.dom3ds.MAT_SHIN2PCT.tag, Dice3DS.dom3ds.MAT_SHIN3PCT.tag, Dice3DS.dom3ds.MAT_TRANSPARENCY.tag, Dice3DS.dom3ds.MAT_XPFALL.tag, Dice3DS.dom3ds.MAT_REFBLUR.tag, Dice3DS.dom3ds.MAT_SELF_ILLUM.tag, Dice3DS.dom3ds.MAT_TWO_SIDE.tag, Dice3DS.dom3ds.MAT_DECAL.tag, Dice3DS.dom3ds.MAT_ADDITIVE.tag, Dice3DS.dom3ds.MAT_SELF_ILPCT.tag, Dice3DS.dom3ds.MAT_WIRE.tag, Dice3DS.dom3ds.MAT_SUPERSMP.tag, Dice3DS.dom3ds.MAT_WIRESIZE.tag, Dice3DS.dom3ds.MAT_FACEMAP.tag, Dice3DS.dom3ds.MAT_XPFALLIN.tag, Dice3DS.dom3ds.MAT_PHONGSOFT.tag, Dice3DS.dom3ds.MAT_WIREABS.tag, Dice3DS.dom3ds.MAT_SHADING.tag, Dice3DS.dom3ds.MAT_TEXMAP.tag, Dice3DS.dom3ds.MAT_SPECMAP.tag, Dice3DS.dom3ds.MAT_OPACMAP.tag, Dice3DS.dom3ds.MAT_REFLMAP.tag, Dice3DS.dom3ds.MAT_BUMPMAP.tag, Dice3DS.dom3ds.MAT_USE_XPFALL.tag, Dice3DS.dom3ds.MAT_USE_REFBLUR.tag, Dice3DS.dom3ds.MAT_BUMP_PERCENT.tag, Dice3DS.dom3ds.MAT_MAPNAME.tag, Dice3DS.dom3ds.MAT_ACUBIC.tag, Dice3DS.dom3ds.MAT_TEX2MAP.tag, Dice3DS.dom3ds.MAT_SHINMAP.tag, Dice3DS.dom3ds.MAT_SELFIMAP.tag, Dice3DS.dom3ds.MAT_TEXMASK.tag, Dice3DS.dom3ds.MAT_TEXT2MASK.tag, Dice3DS.dom3ds.MAT_OPACMASK.tag, Dice3DS.dom3ds.MAT_BUMPMASK.tag, Dice3DS.dom3ds.MAT_SHINMASK.tag, Dice3DS.dom3ds.MAT_SPECMASK.tag, Dice3DS.dom3ds.MAT_SELFIMASK.tag, Dice3DS.dom3ds.MAT_REFLMASK.tag, Dice3DS.dom3ds.MAT_MAP_TILING.tag, Dice3DS.dom3ds.MAT_MAP_TEXBLUR.tag, Dice3DS.dom3ds.MAT_MAP_USCALE.tag, Dice3DS.dom3ds.MAT_MAP_VSCALE.tag, Dice3DS.dom3ds.MAT_MAP_UOFFSET.tag, Dice3DS.dom3ds.MAT_MAP_VOFFSET.tag, Dice3DS.dom3ds.MAT_MAP_ANG.tag, Dice3DS.dom3ds.MAT_MAP_COL1.tag, Dice3DS.dom3ds.MAT_MAP_COL2.tag, Dice3DS.dom3ds.MAT_MAP_RCOL.tag, Dice3DS.dom3ds.MAT_MAP_GCOL.tag, Dice3DS.dom3ds.MAT_MAP_BCOL.tag, Dice3DS.dom3ds.MAT_ENTRY.tag, Dice3DS.dom3ds.KFDATA.tag, Dice3DS.dom3ds.KFHDR.tag, Dice3DS.dom3ds.KFSEG.tag, Dice3DS.dom3ds.KFCURTIME.tag, Dice3DS.dom3ds.AMBIENT_NODE_TAG.tag, Dice3DS.dom3ds.OBJECT_NODE_TAG.tag, Dice3DS.dom3ds.CAMERA_NODE_TAG.tag, Dice3DS.dom3ds.TARGET_NODE_TAG.tag, Dice3DS.dom3ds.LIGHT_NODE_TAG.tag, Dice3DS.dom3ds.SPOTLIGHT_NODE_TAG.tag, Dice3DS.dom3ds.L_TARGET_NODE_TAG.tag, Dice3DS.dom3ds.NODE_ID.tag, Dice3DS.dom3ds.NODE_HDR.tag, Dice3DS.dom3ds.PIVOT.tag, Dice3DS.dom3ds.INSTANCE_NAME.tag, Dice3DS.dom3ds.MORPH_SMOOTH.tag, Dice3DS.dom3ds.BOUNDBOX.tag, Dice3DS.dom3ds.POS_TRACK_TAG.tag, Dice3DS.dom3ds.COL_TRACK_TAG.tag, Dice3DS.dom3ds.ROT_TRACK_TAG.tag, Dice3DS.dom3ds.SCL_TRACK_TAG.tag, Dice3DS.dom3ds.MORPH_TRACK_TAG.tag, Dice3DS.dom3ds.FOV_TRACK_TAG.tag, Dice3DS.dom3ds.ROLL_TRACK_TAG.tag, Dice3DS.dom3ds.HOT_TRACK_TAG.tag, Dice3DS.dom3ds.FALL_TRACK_TAG.tag, Dice3DS.dom3ds.HIDE_TRACK_TAG.tag, ifc2x3.ifcelement.tag, ifc2x3.ifctypeproduct.tag, ifc2x3.ifcproxy.tag, ifc4.ifcelement.tag, ifc4.ifctypeproduct.tag, ifc4.ifcproxy.tag, Part::Geometry.tag, PathScripts.PathDressupHoldingTags.MapWireToTag.tag, Mod.Show.mTempoVis.TempoVis.tag, Sketcher::Constraint.tag, GCS::Constraint.tag, TechDraw::CosmeticVertex.tag, TechDraw::CosmeticEdge.tag, TechDraw::CenterLine.tag, TechDraw::GeomFormat.tag, TechDraw::BaseGeom.tag, and TechDraw::Vertex.tag.
def FreeCADInit.FCADLogger.warn |
( |
|
self, |
|
|
|
msg, |
|
|
* |
args, |
|
|
** |
kargs |
|
) |
| |
"Warning" level log printer
* msg: message string. May contain new style Python string formatter.
This function accepts additional positional and keyword arguments,
which are forward to string.format() to generate the logging
message. It is strongly recommended to not directly use Python
string formatting, but pass additional arguments here, because the
printer can skip string evaluation in case the logging level is
disabled.
References FreeCADInit.FCADLogger._isEnabledFor(), and FreeCADInit.FCADLogger._log().