Skip to main content

A Mouritech package

Project description

sample package on Logging Error

Project Title

Mouritech

package name : Mouritech_LoggingErrorMT_PY_ErrorLogging

Creating custom package for Logging Errorin python. This is the project ,Whenever you need to check the level of Errors in a code .

Technologie

Python

Installation

Install my-project with Python Install MT_PY_ErrorLogging

  pip install   MT_PY_ErrorLogging
  cd   MT_PY_ErrorLogging

(globally) pip install MT_PY_ErrorLogging

Steps

pip install MT_PY_ErrorLogging

(or)

pip install MT_PY_ErrorLogging

from MT_PY_ErrorLogging.MT_Errorlogging import MT_Logger from MT_ErrorLogging import MT_Logger

MT_Logger(

)

Authors

Used By

This project is used by the following Cases:

  • Projects :-Logging Error is one of the debugging tool which is used to track the log levels of the cod e(error levels of the code )

Receiver Example :

pip install MT_PY_ErrorLogging

from MT_PY_ErrorLogging.MT_Errorlogging import MT_Logger from MT_Errorlogging import MT_PY_ErrorLogging

MT_PY_ErrorLogging(

)

this is the file here we are doing some testcase purpose

import logging #we are importing our package here from MT_PY_ErrorLogging.MT_Errorlogging import MT_Logger

Create a logger

logger = logging.getLogger("fileerrors:") logger.setLevel(logging.ERROR)

Define a custom error handler

class MT_LoggerHandler(logging.Handler): # creating a class def emit(self, record): # creating a function if isinstance(record.exc_info[1], LoggerDemoConsole): print(f"Custom Error: {record.msg}")

Add the custom error handler to the logger

logger.addHandler(MT_LoggerHandler())

Output:

06/01/2023 05:31:15PM - LoggerDemoConsoleINFO: info message 06/01/2023 05:31:15PM - LoggerDemoConsoleWARNING: warn message 06/01/2023 05:31:15PM - LoggerDemoConsoleERROR: error message 06/01/2023 05:31:15PM - LoggerDemoConsoleCRITICAL: critical message

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

MT_PY_ErrorLogging-0.0.1.tar.gz (2.9 kB view hashes)

Uploaded Source

Built Distribution

MT_PY_ErrorLogging-0.0.1-py3-none-any.whl (3.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page