<div><h2id="sqlite"><ahref="#sqlite"name="sqlite">#</a>SQLite</h2><p><strong>A server-less database engine that stores each database into a separate file.</strong></p><pre><codeclass="python language-python hljs"><spanclass="hljs-keyword">import</span> sqlite3
<conn> = sqlite3.connect(<path>) <spanclass="hljs-comment"># Opens existing or new file. Also ':memory:'.</span>
<conn>.close() <spanclass="hljs-comment"># Closes the connection.</span>
<li><strong>Parent logger can be specified by naming the child logger <codeclass="python hljs"><spanclass="hljs-string">'<parent>.<name>'</span></code>.</strong></li>
<li><strong>If logger doesn't have a set level it inherits it from the first ancestor that does.</strong></li>
<li><strong>Formatter also accepts: pathname, filename, funcName, lineno, thread and process.</strong></li>
<li><strong>A <codeclass="python hljs"><spanclass="hljs-string">'handlers.RotatingFileHandler'</span></code> creates and deletes log files based on 'maxBytes' and 'backupCount' arguments.</strong></li>
<li><strong>A <codeclass="python hljs"><spanclass="hljs-string">'log.handlers.RotatingFileHandler'</span></code> creates and deletes log files based on 'maxBytes' and 'backupCount' arguments.</strong></li>
</ul>
<div><h4id="createsaloggerthatwritesallmessagestofileandsendsthemtotherootshandlerthatprintswarningsorhigher">Creates a logger that writes all messages to file and sends them to the root's handler that prints warnings or higher:</h4><pre><codeclass="python language-python hljs"><spanclass="hljs-meta">>>></span>logger = log.getLogger(<spanclass="hljs-string">'my_module'</span>)