{"id":18464,"date":"2020-06-25T02:41:12","date_gmt":"2020-06-25T09:41:12","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=18464"},"modified":"2023-12-01T03:23:36","modified_gmt":"2023-12-01T11:23:36","slug":"python-logging","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/python-logging\/","title":{"rendered":"Python Logging: A Guide"},"content":{"rendered":"\n<p>You\u2019ve just built an application and have noticed something is not working as intended. The feature you just implemented is behaving in a way you did not expect. What should you do? How are you going to address this problem?<br><br><\/p>\n\n\n\n<p>In software development, programmers rely on logging to track events while their software is running. This helps them effectively track down the source of problems should they arise.<br><\/p>\n\n\n\n<p>In this guide, we\u2019re going to talk about why you should keep application logs and how you can use the Python logging module to keep track of events in your programs.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why You Should Keep Logs<\/h2>\n\n\n\n<p>Keeping logs helps you write more maintainable code. When you use a module like logging, you can keep an accurate record of all the events that occur in your programs. This means you can see which lines of code have run and which failed to execute.<br><\/p>\n\n\n\n<p>In Python, developers often rely on the <code>print()<\/code> statement to log their code. It\u2019s a practice everyone \u2013 from beginners to experts \u2013 is guilty of using and with good reason. A <code>print()<\/code> statement is easy to use; it\u2019s simple.<br><\/p>\n\n\n\n<p>However, the <code>print()<\/code> statement is not the best way to keep logs of your code. For one thing, the <code>print()<\/code> statement can be used to print any output to the console. This means it can be confusing to distinguish which output is to be stored as a log and which output is part of your main program. What\u2019s more, the <code>print()<\/code> statement doesn\u2019t save your logs by default.<br><\/p>\n\n\n\n<p>That\u2019s where the Python logging module comes in handy. Using the logging system module, you can keep more accurate records of what events have run in your code. This will help you debug your code more effectively and fix errors.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Use the Python Logging Module<\/h2>\n\n\n\n<p>In this tutorial, we\u2019re going to be adding basic logging messages to a program that goes through a list of student grades and calculates whether they have failed or passed their exam. Consider the following code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>students = [\"Martin\", \"Lewis\", \"Terri\", \"Bart\"]\ngrades = [92, 78, 72, 38]\npass_fail = []\nfor i in range(0, len(students)):\n\tprint(\"Calculating grade for {}\".format(students[i]))\n\tif grades[i] &gt; 55:\n\t\tpass_fail.append(True)\n\t\tprint(\"{} has passed their exam.\".format(students[i)))\n\telse:\n\t\tpass_fail.append(False)\n\t\tprint(\"{} has failed their exam.\".format(students[i)))\nprint(\"Student grades have been calculated. Moving on to send emails to parents of students who have failed their exams.\")<\/pre><\/div>\n\n\n\n<p>The code above calculates whether each of five students in a fourth grade class have passed their exam. In our program, we declare three lists. One list stores the name of each student; another list stores the grade each student earned; the final list stores whether a student has passed or failed their exam.<br><\/p>\n\n\n\n<p>When we run our program, the following is returned:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Calculating grade for Martin.\nMartin has passed their exam.\nCalculating grade for Lewis.\nLewis has passed their exam.\nCalculating grades for Terri.\nTerri has passed their exam.\nCalculating grades for Bart.\nBart has failed their exam.<\/pre><\/div>\n\n\n\n<p>The <code>print()<\/code> statement shows our code is working, but we could use the <code>logging()<\/code> module to show this data instead. This will allow us to distinguish our debugging messages from the output of our program.<br><\/p>\n\n\n\n<p>To start, let\u2019s add the logging standard library at the top of our program:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>import logging<\/pre><\/div>\n\n\n\n<p>Now that we\u2019ve imported the logging library, we can start to keep track of logs in our code. For this example, we are going to keep track of logs using the DEBUG configuration. This is because we are not interested in tracking warnings at this time. For reference, here are the logging options you can specify:<br><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>CRITICAL: Used to display serious errors (logging.critical())<\/li>\n\n\n\n<li>ERROR: Used to show a problem (logging.error())<\/li>\n\n\n\n<li>WARNING: Used to show unexpected behavior (logging.warning())<\/li>\n\n\n\n<li>INFO: Used to show a program is working (logging.info())<\/li>\n\n\n\n<li>DEBUG: Used to debug code (logging.debug())<\/li>\n<\/ul>\n\n\n\n<p>The default configuration for the logging library is WARNING, so we\u2019ll have to reset it using this code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>import logging\nlogging.basicConfig(level=logging.DEBUG)<\/pre><\/div>\n\n\n\n<p>Now we\u2019re ready to start debugging our code. Let\u2019s replace our <code>print()<\/code> statements that tell us that a grade is being calculated or that our program has finished with debugging statements:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>import logging\nlogging.basicConfig(level=logging.DEBUG)\nstudents = [\"Martin\", \"Lewis\", \"Terri\", \"Bart\"]\ngrades = [92, 78, 72, 38]\npass_fail = []\nfor i in range(0, len(students)):\n\tlogging.debug(\"Calculating grade for {}\".format(students[i]))\n\tif grades[i] &gt; 55:\n\t\tpass_fail.append(True)\n\t\tprint(\"{} has passed their exam.\".format(students[i]))\n\telse:\n\t\tpass_fail.append(False)\n\t\tprint(\"{} has failed their exam.\".format(students[i]))\nlogging.debug(\"Student grades have been calculated. Moving on to send emails to parents of students who have failed their exams.\")<\/pre><\/div>\n\n\n\n<p>When we run our code, the following is returned:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>DEBUG:root:Calculating grade for Martin\nMartin has passed their exam.\nDEBUG:root:Calculating grade for Lewis\nLewis has passed their exam.\nDEBUG:root:Calculating grade for Terri\nTerri has passed their exam.\nDEBUG:root:Calculating grade for Bart\nBart has failed their exam.\nDEBUG:root:Student grades have been calculated. Moving on to send emails to parents of students who have failed their exams.<\/pre><\/div>\n\n\n\n<p>You can see that our output contains the same content as earlier. However, the message \u201cCalculating grade for\u2026\u201d and the message informing us that the grades have been calculated appear differently. The text \u201cDEBUG:root:\u201d appears before those statements.<br><\/p>\n\n\n\n<p>This allows us to keep track of what our program is doing at any given time. Because the logging events module adds the aforementioned text to our program, it is easy to figure out what text has been outputted by our program and what text is for debugging.<br><\/p>\n\n\n\n<p>In this case, the message \u201c[student]\u201d has failed their exam\u201d is crucial information that tells us whether each student has passed or failed their exam. Everything else is useful to see how our program is running, but is not useful to the user. Hence, we track these statements using logging calls.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Keep Logs in a File<\/h2>\n\n\n\n<p>The logging module allows you to keep track of your logs in a file. This is useful because it means you won\u2019t lose your logs once you close your Python shell. You\u2019ll have a permanent record of how your program executed on a particular occasion.<br><\/p>\n\n\n\n<p>All you need to do is include a filename argument in your logging handler configuration line and your program will automatically save logs to a file:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>import logging\nlogging.basicConfig(level=logging.DEBUG, filename=\"student_data.log\")\n\u2026<\/pre><\/div>\n\n\n\n<p>When we run our code, our logs will be added to the filename we specify. If we open up the \u201cstudent_data.log\u201d file, the following is returned:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>DEBUG:root:Calculating grade for Martin\nDEBUG:root:Calculating grade for Lewis\nDEBUG:root:Calculating grade for Terri\nDEBUG:root:Calculating grade for Bart\nDEBUG:root:Student grades have been calculated. Moving on to send emails to parents of students who have failed their exams.<\/pre><\/div>\n\n\n\n<p>Notice that our debug output only contains the messages we have specified as logs using the <code>logging.debug()<\/code> method. This is useful because it helps us distinguish program output \u2013 which is denoted using a <code>print()<\/code> statement \u2013 from debug logs.<br><\/p>\n\n\n\n<p>You can also add a parameter to keep track of when an entry has been added to your log. We can do so using the following code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>logging.basicConfig(\nlevel=logging.DEBUG,\nfilename=\"student_data.log\",\nformat=\"%(asctime)s:%(levelname)s:%(message)s\"\n)<\/pre><\/div>\n\n\n\n<p>This code adds the following to our student_data.log file:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>2020-06-18 08:27:50,123:DEBUG:Calculating grade for Martin\n2020-06-18 08:27:50,123:DEBUG:Calculating grade for Lewis\n2020-06-18 08:27:50,123:DEBUG:Calculating grade for Terri\n2020-06-18 08:27:50,123:DEBUG:Calculating grade for Bart\n2020-06-18 08:27:50,124:DEBUG:Student grades have been calculated. Moving on to send emails to parents of students who have failed their exams.<\/pre><\/div>\n\n\n\n<p>Now we know when each line of our code was executed. In a longer program, this data would be especially useful because it would help us understand the order in which our code is running and the speed of our code.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>The Python logging module is an incredibly useful tool for debugging. It helps you track all the events that run in your program and gives you the option to save those events as a separate file. This will help you more effectively debug your code and understand what events have executed when you run a program.&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"You\u2019ve just built an application and have noticed something is not working as intended. The feature you just implemented is behaving in a way you did not expect. What should you do? How are you going to address this problem? In software development, programmers rely on logging to track events while their software is running.&hellip;","protected":false},"author":240,"featured_media":18465,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[16578],"tags":[],"class_list":{"0":"post-18464","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-python"},"acf":{"post_sub_title":"","sprint_id":"","query_class":"Python","school_sft":"","parent_sft":"","school_privacy_policy":"","has_review":"","is_sponser_post":"","is_guest_post":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.0 (Yoast SEO v27.0) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Python Logging: A Guide | Career Karma<\/title>\n<meta name=\"description\" content=\"The Python logging module allows you to keep track of your programs. On Career Karma, learn how to create logs using the Python logging module.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/careerkarma.com\/blog\/python-logging\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Logging: A Guide\" \/>\n<meta property=\"og:description\" content=\"The Python logging module allows you to keep track of your programs. On Career Karma, learn how to create logs using the Python logging module.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/python-logging\/\" \/>\n<meta property=\"og:site_name\" content=\"Career Karma\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/facebook.com\/careerkarmaapp\" \/>\n<meta property=\"article:published_time\" content=\"2020-06-25T09:41:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T11:23:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/fotis-fotopoulos-DuHKoV44prg-unsplash.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1020\" \/>\n\t<meta property=\"og:image:height\" content=\"680\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"James Gallagher\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@career_karma\" \/>\n<meta name=\"twitter:site\" content=\"@career_karma\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"James Gallagher\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-logging\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-logging\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"Python Logging: A Guide\",\"datePublished\":\"2020-06-25T09:41:12+00:00\",\"dateModified\":\"2023-12-01T11:23:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-logging\/\"},\"wordCount\":1034,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-logging\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/fotis-fotopoulos-DuHKoV44prg-unsplash.jpg\",\"articleSection\":[\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/careerkarma.com\/blog\/python-logging\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-logging\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/python-logging\/\",\"name\":\"Python Logging: A Guide | Career Karma\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-logging\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-logging\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/fotis-fotopoulos-DuHKoV44prg-unsplash.jpg\",\"datePublished\":\"2020-06-25T09:41:12+00:00\",\"dateModified\":\"2023-12-01T11:23:36+00:00\",\"author\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"The Python logging module allows you to keep track of your programs. On Career Karma, learn how to create logs using the Python logging module.\",\"breadcrumb\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-logging\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/careerkarma.com\/blog\/python-logging\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-logging\/#primaryimage\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/fotis-fotopoulos-DuHKoV44prg-unsplash.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/fotis-fotopoulos-DuHKoV44prg-unsplash.jpg\",\"width\":1020,\"height\":680},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-logging\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\/\/careerkarma.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python\",\"item\":\"https:\/\/careerkarma.com\/blog\/python\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Python Logging: A Guide\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\",\"url\":\"https:\/\/careerkarma.com\/blog\/\",\"name\":\"Career Karma\",\"description\":\"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/careerkarma.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\",\"name\":\"James Gallagher\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg\",\"caption\":\"James Gallagher\"},\"description\":\"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.\",\"url\":\"https:\/\/careerkarma.com\/blog\/author\/jamesgallagher\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Python Logging: A Guide | Career Karma","description":"The Python logging module allows you to keep track of your programs. On Career Karma, learn how to create logs using the Python logging module.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/careerkarma.com\/blog\/python-logging\/","og_locale":"en_US","og_type":"article","og_title":"Python Logging: A Guide","og_description":"The Python logging module allows you to keep track of your programs. On Career Karma, learn how to create logs using the Python logging module.","og_url":"https:\/\/careerkarma.com\/blog\/python-logging\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-06-25T09:41:12+00:00","article_modified_time":"2023-12-01T11:23:36+00:00","og_image":[{"width":1020,"height":680,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/fotis-fotopoulos-DuHKoV44prg-unsplash.jpg","type":"image\/jpeg"}],"author":"James Gallagher","twitter_card":"summary_large_image","twitter_creator":"@career_karma","twitter_site":"@career_karma","twitter_misc":{"Written by":"James Gallagher","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/careerkarma.com\/blog\/python-logging\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/python-logging\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"Python Logging: A Guide","datePublished":"2020-06-25T09:41:12+00:00","dateModified":"2023-12-01T11:23:36+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/python-logging\/"},"wordCount":1034,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/python-logging\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/fotis-fotopoulos-DuHKoV44prg-unsplash.jpg","articleSection":["Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/python-logging\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/python-logging\/","url":"https:\/\/careerkarma.com\/blog\/python-logging\/","name":"Python Logging: A Guide | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/python-logging\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/python-logging\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/fotis-fotopoulos-DuHKoV44prg-unsplash.jpg","datePublished":"2020-06-25T09:41:12+00:00","dateModified":"2023-12-01T11:23:36+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"The Python logging module allows you to keep track of your programs. On Career Karma, learn how to create logs using the Python logging module.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/python-logging\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/python-logging\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/python-logging\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/fotis-fotopoulos-DuHKoV44prg-unsplash.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/fotis-fotopoulos-DuHKoV44prg-unsplash.jpg","width":1020,"height":680},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/python-logging\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/careerkarma.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Python","item":"https:\/\/careerkarma.com\/blog\/python\/"},{"@type":"ListItem","position":3,"name":"Python Logging: A Guide"}]},{"@type":"WebSite","@id":"https:\/\/careerkarma.com\/blog\/#website","url":"https:\/\/careerkarma.com\/blog\/","name":"Career Karma","description":"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/careerkarma.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94","name":"James Gallagher","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","caption":"James Gallagher"},"description":"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.","url":"https:\/\/careerkarma.com\/blog\/author\/jamesgallagher\/"}]}},"_links":{"self":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/18464","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/users\/240"}],"replies":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/comments?post=18464"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/18464\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/18465"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=18464"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=18464"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=18464"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}