cpython/Doc/howto/logging_flow.svg

<svg width="22cm" height="23cm" viewBox="1 1 439 446" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <!-- Invert color in dark mode -->
  <style type="text/css">
    svg {
      background-color: transparent !important;
    }
    line {
      stroke: #000000;
      fill: none;
      stroke-opacity: 1;
    }
    polygon, rect {
      fill: none;
      stroke: #000000;
      fill-opacity: 1;
      stroke-opacity: 1;
    }
    polygon.filled {
      fill: #000000;
    }
    polyline {
      fill: none;
      stroke-opacity: 1;
      stroke: #000000;
    }
    text {
      fill: #000000;
      fill-opacity: 1;
      stroke: none;
      font-family: sans-serif;
      font-style: normal;
      font-weight: normal;
      text-anchor: start;
    }
    @media (prefers-color-scheme: dark) {
      polygon, rect, polyline, line {
        stroke: #ffffff;
      }
      polygon.filled {
        fill: #ffffff;
      }
      text {
        fill: #ffffff;
      }
      image {
        filter: invert(100%) hue-rotate(180deg) saturate(1.25);
      }
    }
    /* These rules are for when the theme selector is used, perhaps in contrast to the browser theme. */
    body.dark-theme polygon, body.dark-theme rect, body.dark-theme polyline, body.dark-theme line {
      stroke: #ffffff;
    }
    body.dark-theme polygon.filled {
      fill: #ffffff;
    }
    body.dark-theme text {
      fill: #ffffff;
    }
    body.light-theme polygon, body.light-theme rect, body.light-theme polyline, body.light-theme line {
      stroke: #000000;
    }
    body.light-theme polygon.filled {
      fill: #000000;
    }
    body.light-theme text {
      fill: #000000;
    }
  </style>

  <defs />
  <g id="Background">
    <rect style="stroke-width: 1.8; stroke-dasharray: 3;" x="227.504" y="1.91011" width="211.607" height="207.375" rx="0" ry="0" />
    <rect style="stroke-width: 1.2;" x="230.966" y="5.62454" width="68.4216" height="21.9166" rx="0" ry="0" />
    <rect style="stroke-width: 1.2;" x="5.27912" y="5.70399" width="68.4216" height="21.9166" rx="0" ry="0" />
    <text font-size="6.77333" style="font-weight: 700;" x="17.0649" y="19.0071">
      <tspan x="17.0649" y="19.0071">Logger flow</tspan>
    </text>
    <g>
      <rect x="81.5533" y="106.469" width="44.45" height="25.9333" rx="0" ry="0" />
      <text font-size="6.77333" style="text-anchor: middle;" x="103.778" y="117.256">
        <tspan x="103.778" y="117.256">Create</tspan>
        <tspan x="103.778" y="125.723" style="font-family: monospace">LogRecord</tspan>
      </text>
    </g>
    <g>
      <line x1="103.778" y1="82.8734" x2="103.778" y2="102.351" />
      <polygon fill-rule="evenodd" points="103.778,105.351 101.778,101.351 103.778,102.351 105.778,101.351 " />
    </g>
    <g>
      <line x1="103.774" y1="3.65583" x2="103.778" y2="30.3755" />
      <polygon fill-rule="evenodd" points="103.778,33.3755 101.778,29.3758 103.778,30.3755 105.778,29.3752 " />
    </g>
    <text font-size="6.77333" style="text-anchor: middle;" x="144.365" y="10.4604">
      <tspan x="143.798" y="10.4604">Logging call in user</tspan>
      <tspan x="143.798" y="18.927">code, e.g.</tspan>
    </text>
    <text font-size="6.77333" style="font-family: monospace;" x="110.837" y="27.4696">
      <tspan x="111.893" y="27.4696">logger.info(...)</tspan>
    </text>
    <g>
      <line x1="155.62" y1="58.6834" x2="183.943" y2="58.6924" />
      <polygon fill-rule="evenodd" points="186.943,58.6933 182.942,60.6921 183.943,58.6924 182.943,56.6921 " />
    </g>
    <g>
      <rect x="188.061" y="49.9604" width="24.4" height="17.4667" rx="6" ry="6" />
      <text font-size="6.77333" style="text-anchor: middle;" x="200.261" y="60.7475">
        <tspan x="200.261" y="60.7475">Stop</tspan>
      </text>
    </g>
    <g>
      <polygon fill-rule="evenodd" points="103.778,162.482 169.307,193.042 103.778,223.603 38.2493,193.042 " />
      <text font-size="6.77333" style="text-anchor: middle;" x="103.778" y="186.629">
        <tspan x="103.778" y="188.741">Does a filter attached</tspan>
        <tspan x="103.778" y="197.208">to logger reject the</tspan>
        <tspan x="103.778" y="205.675">record?</tspan>
      </text>
    </g>
    <g>
      <line x1="103.778" y1="132.402" x2="103.778" y2="158.364" />
      <polygon class="filled" fill-rule="evenodd" points="103.778,161.364 101.778,157.364 103.778,158.364 105.778,157.364 " />
    </g>
    <g>
      <rect x="75.2033" y="249.478" width="57.15" height="34.4" rx="0" ry="0" />
      <text font-size="6.77333" style="text-anchor: middle;" x="103.778" y="260.265">
        <tspan x="103.778" y="260.265">Pass record to</tspan>
        <tspan x="103.778" y="268.732">handlers of</tspan>
        <tspan x="103.778" y="277.198">current logger</tspan>
      </text>
    </g>
    <g>
      <polygon fill-rule="evenodd" points="103.778,326.569 158.193,352.399 103.778,378.229 49.3637,352.399 " />
      <text font-size="6.77333" style="text-anchor: middle;" x="103.778" y="350.22">
        <tspan x="103.778" y="351.276">Is propagate true for</tspan>
        <tspan x="103.778" y="359.742">current logger?</tspan>
      </text>
    </g>
    <g>
      <polygon fill-rule="evenodd" points="103.778,399.9 150.573,422.994 103.778,446.087 56.984,422.994 " />
      <text font-size="6.77333" style="text-anchor: middle;" x="103.778" y="420.814">
        <tspan x="103.778" y="422.926">Is there a parent</tspan>
        <tspan x="103.778" y="431.393">logger?</tspan>
      </text>
    </g>
    <g>
      <rect x="2.43852" y="295.984" width="63.9" height="26.5909" rx="0" ry="0" />
      <text font-size="6.77333" style="text-anchor: middle;" x="34.3885" y="307.1">
        <tspan x="34.3885" y="307.1">Set current</tspan>
        <tspan x="34.3885" y="315.566">logger to parent</tspan>
      </text>
    </g>
    <g>
      <polygon fill-rule="evenodd" points="278.422,240.202 330.96,266.686 278.422,293.169 225.885,266.686 " />
      <text font-size="6.77333" style="text-anchor: middle;" x="278.422" y="264.506">
        <tspan x="278.422" y="266.618">At least one handler</tspan>
        <tspan x="278.422" y="275.085">in hierarchy?</tspan>
      </text>
    </g>
    <g>
      <rect x="298.963" y="312.257" width="57.75" height="25.9333" rx="0" ry="0" />
      <text font-size="6.77333" x="327.838" y="323.044">
        <tspan x="301" y="324.100">Use</tspan>
        <tspan x="315" y="324.100" style="font-family: monospace">lastResort</tspan>
        <tspan x="316" y="332.567">handler</tspan>
      </text>
    </g>
    <g>
      <polygon fill-rule="evenodd" points="320.041,35.7307 373.377,60.8536 320.041,85.9765 266.704,60.8536 " />
      <text font-size="6.77333" style="text-anchor: middle;" x="320.041" y="58.6741">
        <tspan x="320.041" y="58.6741">Handler enabled for</tspan>
        <tspan x="320.041" y="67.1407">level of record?</tspan>
      </text>
    </g>
    <g>
      <polygon fill-rule="evenodd" points="320.041,105.448 386.002,135.748 320.041,166.047 254.08,135.748 " />
      <text font-size="6.77333" style="text-anchor: middle;" x="320.041" y="129.335">
        <tspan x="320.041" y="132.508">Does a filter attached</tspan>
        <tspan x="320.041" y="140.970">to handler reject the</tspan>
        <tspan x="320.041" y="149.436">record?</tspan>
      </text>
    </g>
    <g>
      <rect x="409.532" y="52.4436" width="24.4" height="17.4667" rx="6" ry="6" />
      <text font-size="6.77333" style="text-anchor: middle;" x="421.732" y="63.2307">
        <tspan x="421.732" y="63.2307">Stop</tspan>
      </text>
    </g>
    <g>
      <rect x="271.091" y="185.519" width="97.9" height="17.4667" rx="6" ry="6" />
      <text font-size="6.77333" style="text-anchor: middle;" x="320.041" y="196.306">
        <tspan x="320.041" y="196.306">Emit (includes formatting)</tspan>
      </text>
    </g>
    <text font-size="6.77333" style="font-weight: 700;" x="241.002" y="18.9277">
      <tspan x="241.002" y="18.9277">Handler flow</tspan>
    </text>
    <g>
      <polygon fill-rule="evenodd" points="103.778,34.4935 155.62,58.6834 103.778,82.8734 51.9368,58.6834 " />
      <text font-size="6.77333" style="text-anchor: middle;" x="103.778" y="56.5039">
        <tspan x="103.778" y="57.560">Logger enabled for</tspan>
        <tspan x="103.778" y="66.026">level of call?</tspan>
      </text>
    </g>
    <g>
      <line x1="103.778" y1="223.603" x2="103.778" y2="245.36" />
      <polygon class="filled" fill-rule="evenodd" points="103.778,248.36 101.778,244.36 103.778,245.36 105.778,244.36 " />
    </g>
    <g>
      <line x1="103.778" y1="283.878" x2="103.778" y2="322.451" />
      <polygon class="filled" fill-rule="evenodd" points="103.778,325.451 101.778,321.451 103.778,322.451 105.778,321.451 " />
    </g>
    <g>
      <line x1="103.778" y1="378.229" x2="103.778" y2="395.782" />
      <polygon class="filled" fill-rule="evenodd" points="103.778,398.782 101.778,394.782 103.778,395.782 105.778,394.782 " />
    </g>
    <g>
      <polyline points="56.984,422.994 34.3885,422.994 34.3885,326.693 " />
      <polygon class="filled" fill-rule="evenodd" points="34.3885,323.693 36.3885,327.693 34.3885,326.693 32.3885,327.693 " />
    </g>
    <g>
      <polyline points="34.3885,295.984 34.3885,266.678 71.0853,266.678 " />
      <polygon class="filled" fill-rule="evenodd" points="74.0853,266.678 70.0853,268.678 71.0853,266.678 70.0853,264.678 " />
    </g>
    <g>
      <polyline points="150.573,422.994 200.261,422.994 200.261,71.5451 " />
      <polygon class="filled" fill-rule="evenodd" points="200.261,68.5451 202.261,72.5451 200.261,71.5451 198.261,72.5451 " />
    </g>
    <g>
      <line style="stroke-dasharray: 5" x1="132.353" y1="266.678" x2="221.767" y2="266.685" />
      <polygon class="filled" fill-rule="evenodd" points="224.767,266.686 220.766,268.685 221.767,266.685 220.767,264.685 " />
    </g>
    <g>
      <polyline style="stroke-dasharray: 5" points="278.422,293.169 278.422,325.224 294.845,325.224 " />
      <polygon class="filled" fill-rule="evenodd" points="297.845,325.224 293.845,327.224 294.845,325.224 293.845,323.224 " />
    </g>
    <g>
      <polyline points="169.307,193.042 200.261,193.042 200.261,71.5451 " />
      <polygon class="filled" fill-rule="evenodd" points="200.261,68.5451 202.261,72.5451 200.261,71.5451 198.261,72.5451 " />
    </g>
    <g>
      <polyline points="158.193,352.399 200.261,352.399 200.261,71.5451 " />
      <polygon class="filled" fill-rule="evenodd" points="200.261,68.5451 202.261,72.5451 200.261,71.5451 198.261,72.5451 " />
    </g>
    <g>
      <line x1="319.981" y1="4.27261" x2="320.033" y2="31.6127" />
      <polygon class="filled" fill-rule="evenodd" points="320.039,34.6127 318.031,30.6165 320.033,31.6127 322.031,30.6089 " />
    </g>
    <g>
      <line x1="320.041" y1="85.9765" x2="320.041" y2="101.33" />
      <polygon class="filled" fill-rule="evenodd" points="320.041,104.33 318.041,100.33 320.041,101.33 322.041,100.33 " />
    </g>
    <g>
      <line x1="320.041" y1="166.047" x2="320.041" y2="181.401" />
      <polygon class="filled" fill-rule="evenodd" points="320.041,184.401 318.041,180.401 320.041,181.401 322.041,180.401 " />
    </g>
    <g>
      <polyline points="386.002,135.748 421.732,135.748 421.732,74.0283 " />
      <polygon class="filled" fill-rule="evenodd" points="421.732,71.0283 423.732,75.0283 421.732,74.0283 419.732,75.0283 " />
    </g>
    <g>
      <line x1="373.377" y1="60.8536" x2="405.415" y2="61.1401" />
      <polygon class="filled" fill-rule="evenodd" points="408.414,61.1669 404.397,63.1311 405.415,61.1401 404.433,59.1312 " />
    </g>
    <text font-size="6.77333" x="164.96" y="55.5649">
      <tspan x="164.96" y="55.5649">No</tspan>
    </text>
    <text font-size="6.77333" x="106.571" y="97.8453">
      <tspan x="106.571" y="97.8453">Yes</tspan>
    </text>
    <text font-size="6.77333" x="173.856" y="188.452">
      <tspan x="173.856" y="188.452">Yes</tspan>
    </text>
    <text font-size="6.77333" x="107.446" y="239.221">
      <tspan x="107.446" y="239.221">No</tspan>
    </text>
    <text font-size="6.77333" x="174.731" y="349.418">
      <tspan x="174.731" y="349.418">No</tspan>
    </text>
    <text font-size="6.77333" x="106.571" y="390.507">
      <tspan x="106.571" y="390.507">Yes</tspan>
    </text>
    <text font-size="6.77333" x="39.4722" y="417.667">
      <tspan x="39.4722" y="417.667">Yes</tspan>
    </text>
    <text font-size="6.77333" x="174.731" y="417.667">
      <tspan x="174.731" y="417.667">No</tspan>
    </text>
    <text font-size="6.77333" x="281.451" y="313.406">
      <tspan x="281.451" y="313.406">No</tspan>
    </text>
    <text font-size="6.77333" x="333.909" y="263.96">
      <tspan x="333.909" y="263.96">Yes</tspan>
    </text>
    <text font-size="6.77333" x="333.307" y="105.598">
      <tspan x="333.307" y="105.598"></tspan>
    </text>
    <text font-size="6.77333" x="385.766" y="56.9098">
      <tspan x="385.766" y="56.9098">No</tspan>
    </text>
    <text font-size="6.77333" x="333.307" y="105.598">
      <tspan x="333.307" y="105.598"></tspan>
    </text>
    <text font-size="6.77333" x="333.307" y="105.598">
      <tspan x="333.307" y="105.598"></tspan>
    </text>
    <text font-size="6.77333" x="397.102" y="130.471">
      <tspan x="397.102" y="130.471">Yes</tspan>
    </text>
    <text font-size="6.77333" x="323.563" y="178.785">
      <tspan x="323.563" y="178.785">No</tspan>
    </text>
    <text font-size="6.77333" x="333.307" y="105.598">
      <tspan x="333.307" y="105.598"></tspan>
    </text>
    <text font-size="6.77333" x="323.75" y="99.0042">
      <tspan x="323.75" y="99.0042">Yes</tspan>
    </text>
    <text font-size="6.77323" style="text-anchor: middle;" x="355.762" y="18.2449">
      <tspan x="355.762" y="18.2449">Record passed</tspan>
      <tspan x="355.762" y="26.7116">to handler</tspan>
    </text>
    <line style="stroke-dasharray: 5" x1="330.96" y1="266.686" x2="377.733" y2="267.908" />
    <g>
      <polyline style="fill: none; stroke-opacity: 1; stroke-dasharray: 5" points="356.713,325.224 377.733,325.224 377.733,214.711 " />
      <polygon class="filled" fill-rule="evenodd" points="377.733,211.711 379.733,215.711 377.733,214.711 375.733,215.711 " />
    </g>
  </g>
</svg>