<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Kunal Gehlot on Medium]]></title>
        <description><![CDATA[Stories by Kunal Gehlot on Medium]]></description>
        <link>https://medium.com/@Zackcodes.ai?source=rss-a64f131f0565------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*NscblJzLWumQy1W9uzBrfA.jpeg</url>
            <title>Stories by Kunal Gehlot on Medium</title>
            <link>https://medium.com/@Zackcodes.ai?source=rss-a64f131f0565------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 22:10:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@Zackcodes.ai/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Simplify Logging in Python with logEZ: A Comprehensive Guide  [Release 0.1.0]]]></title>
            <link>https://medium.com/@Zackcodes.ai/simplify-logging-in-python-with-logez-a-comprehensive-guide-release-0-1-0-244729a63c19?source=rss-a64f131f0565------2</link>
            <guid isPermaLink="false">https://medium.com/p/244729a63c19</guid>
            <category><![CDATA[python-tricks]]></category>
            <category><![CDATA[programming-tips]]></category>
            <category><![CDATA[python-logging]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Kunal Gehlot]]></dc:creator>
            <pubDate>Sun, 02 Apr 2023 01:16:06 GMT</pubDate>
            <atom:updated>2023-04-02T01:21:51.353Z</atom:updated>
            <content:encoded><![CDATA[<p>Are you looking for an easy way to add logging to your Python programs? Do you want a simple yet powerful library that takes care of your logging needs? Introducing logEZ — the logging solution that makes your life easier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ruKwn7ak_g96fotd4229Iw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@jjying?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">JJ Ying</a> on <a href="https://unsplash.com/photos/WmnsGyaFnCQ?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>Why Logging Matters</h3><p>As your applications grow in size and complexity, it becomes increasingly important to understand how they work internally and how each module behaves individually. Logging helps you keep track of each module, its connections, and identify potential issues. With proper logging in place, you can determine where and why your application breaks down — a crucial aspect when developing production-level applications.</p><p>In this article, we will explore <strong>logEZ</strong> — a Python library designed to simplify logging, and walk you through its features and usage.</p><h3>Getting Started with logEZ</h3><p>First, install the logEZ library using pip:</p><pre>pip install logEZ</pre><p>The library supports all Python 3 versions, and the logging library should automatically install.</p><p>Once you’ve installed the library, import and initialize the MyLogger() class:</p><pre>from logEZ import MyLogger<br><br>logger = MyLogger()</pre><p>With the logger object ready, you can call the logging functions to add logs as needed:</p><ul><li>debug(inString: str): Log a DEBUG level message. Accepts a string input.</li><li>info(inString: str): Log an INFO level message. Accepts a string input.</li><li>warning(inString: str): Log a WARNING level message. Accepts a string input.</li><li>error(inString: str, exc_info: Optional[bool] = False): Log an ERROR level message. Accepts a string input. If exc_info is set to True, it appends the complete execution information along with the log string.</li><li>critical(inString: str, exc_info: Optional[bool] = False): Log a CRITICAL level message. Accepts a string input. If exc_info is set to True, it appends the complete execution information along with the log string.</li></ul><h3>A Sample Application</h3><p>Now let’s see logEZ in action with a simple example:</p><pre>from logEZ import MyLogger<br>import os<br><br>logger = MyLogger()<br><br>def read_data_from_file(file_path: str):<br>    if not os.path.exists(file_path):<br>        logger.error(f&quot;File not found: {file_path}&quot;, exc_info=True)<br>        return None<br><br>    try:<br>        with open(file_path, &#39;r&#39;) as file:<br>            data = file.readlines()<br>        logger.info(f&quot;Successfully read data from {file_path}&quot;)<br>    except Exception as e:<br>        logger.error(f&quot;An error occurred while reading data from {file_path}&quot;, exc_info=True)<br>        return None<br><br>    return data<br><br>def calculate_average(numbers):<br>    try:<br>        average = sum(numbers) / len(numbers)<br>        logger.info(f&quot;Calculated average: {average}&quot;)<br>        return average<br>    except ZeroDivisionError as e:<br>        logger.error(f&quot;An error occurred while calculating the average&quot;, exc_info=True)<br>        return None<br>    except Exception as e:<br>        logger.error(f&quot;An unexpected error occurred while calculating the average&quot;, exc_info=True)<br>        return None<br><br>def main():<br>    logger.info(&quot;Starting the application...&quot;)<br><br>    file_path = &quot;data.txt&quot;<br>    data = read_data_from_file(file_path)<br><br>    if data is not None:<br>        try:<br>            numbers = [float(x.strip()) for x in data]<br>        except ValueError as e:<br>            logger.critical(&quot;Failed to convert data to numbers. Terminating the application...&quot;, exc_info=True)<br>            return<br><br>        average = calculate_average(numbers)<br>        if average is not None:<br>            logger.info(f&quot;The average of the numbers is {average}&quot;)<br><br>    logger.info(&quot;Ending the application...&quot;)<br><br>if __name__ == &quot;__main__&quot;:<br>    main()</pre><p>In this example, the application reads data from a file, converts the data into a list of numbers, and calculates the average of those numbers. The logEZ library is used to log messages at different logging levels, including info, error, and critical messages. The exc_info parameter is used to include complete execution information when logging error and critical messages.</p><p>When run, the output will look something like this (assuming the file data.txt does not exist):</p><pre>01-04-23 15:45:36 - root : INFO : Starting the application...<br>01-04-23 15:45:36 - root : ERROR : File not found: data.txt<br>Traceback (most recent call last):<br>  File &quot;example.py&quot;, line 6, in read_data_from_file<br>    if not os.path.exists(file_path):<br>FileNotFoundError: [Errno 2] No such file or directory: &#39;data.txt&#39;<br>01-04-23 15:45:36 - root : INFO : Ending the application...</pre><p>This output shows various log messages, including info and error messages, and includes the traceback for the FileNotFoundErrorexception because the exc_info parameter was set to True.</p><h3>Be a Part of the logEZ Community</h3><p>We are excited to have you join the logEZ community! If you have any suggestions, face any problems, or want to contribute to the project, feel free to raise issues on <a href="https://github.com/KunalGehlot/logEZ">GitHub</a> or reach out to me via email at <a href="/service/mailto:gehlotkunal@outlook.com">gehlotkunal@outlook.com</a></p><p>Project Repo: <a href="https://github.com/KunalGehlot/logEZ">https://github.com/KunalGehlot/logEZ</a></p><p>PyPi: <a href="https://pypi.org/project/logEZ/">https://pypi.org/project/logEZ/</a></p><p>Let’s make logging in Python easier together! Happy coding! 🛠️🤝</p><p>#PythonLogging #logEZ #PythonDeveloper #Debugging #PythonTips #PythonTricks</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=244729a63c19" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to add logging to your python program, the easy way! [Deprecated]]]></title>
            <link>https://medium.com/@Zackcodes.ai/how-to-add-logging-to-your-python-program-the-easy-way-c35c16a61d59?source=rss-a64f131f0565------2</link>
            <guid isPermaLink="false">https://medium.com/p/c35c16a61d59</guid>
            <category><![CDATA[logging]]></category>
            <category><![CDATA[python3]]></category>
            <category><![CDATA[python-logging]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Kunal Gehlot]]></dc:creator>
            <pubDate>Fri, 05 Aug 2022 14:28:18 GMT</pubDate>
            <atom:updated>2023-04-02T01:19:43.819Z</atom:updated>
            <content:encoded><![CDATA[<p>Refer: <a href="https://medium.com/@Zackcodes.ai/simplify-logging-in-python-with-logez-a-comprehensive-guide-release-0-1-0-244729a63c19">https://medium.com/@Zackcodes.ai/simplify-logging-in-python-with-logez-a-comprehensive-guide-release-0-1-0-244729a63c19</a></p><p>Are you wondering how you can add logging to your python program quickly and easily? This is the article you were searching for!</p><p>Logging is the best way to know how your application runs internally and how each module behaves individually. Logging becomes more critical when your applications grow in <em>size</em> and <em>complexity,</em> and it becomes harder and harder to keep track of each module and its connections. Logging can also point out <em>where</em> the application broke down and <em>why</em>. This is very important when you need to create a production-level application.</p><p>While working on similar production-level applications, I created a logging script that I constantly copied from one to another. This was when I decided to release the python library <strong>logEZ</strong>.</p><p>You can simply install this library using</p><pre>pip install logEZ</pre><p>on your console. It supports all python3 versions.<br><em>Note: You’ll also need the logging library, which should automatically install.</em></p><p>Once you have installed the library, you can import and initialise the <em>MyLogger()</em> class</p><pre>from logEZ import MyLogger<br><br>logger = MyLogger()</pre><p>Once you have the <em>logger</em> object, you just have to call the logging functions to add a log.</p><ul><li>myDebug(str): To print a debug log.</li><li>myInfo(str): To print an info log.</li><li>myWarn(str): To print a warning log.</li><li>myError(str, exc_info[Optional]): To print an error log.</li><li>myCrit(strm exc_info[Optional]): To print an error log.</li><li>myExcept(str): To print an exception log.</li></ul><p>und Prost! Du bist der Weltmeister!</p><p>Install logEZ: <a href="https://pypi.org/project/logEZ/">https://pypi.org/project/logEZ/</a></p><p>For more information, visit: <a href="https://github.com/KunalGehlot/logEZ">https://github.com/KunalGehlot/logEZ</a></p><p>Feel free to raise GitHub issues if you face any problems!<br>Find me on Twitter: @Zackcodes.ai</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c35c16a61d59" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>