34 lines
No EOL
2.3 KiB
HTML
34 lines
No EOL
2.3 KiB
HTML
<!doctype html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<title>Log.set_level — Ludic</title>
|
||
<meta name="description" content="Show only messages at level n or above (0 = all).">
|
||
<link rel="stylesheet" href="base.css">
|
||
<link rel="stylesheet" href="docs.css">
|
||
</head>
|
||
<body>
|
||
<header class="nav"><div class="wrap nav-in"><a class="brand" href="index.html"><span class="logo">L</span> Ludic</a><button class="nav-toggle" aria-label="Toggle menu" aria-expanded="false">☰</button><nav class="nav-links"><a href="index.html">Home</a><a href="api.html">API Reference</a><a class="nav-cta" href="https://git.workshopsoft.io/workshopsoft/ludic">Source ↗</a></nav></div></header>
|
||
<main class="wrap item">
|
||
<div class="crumbs"><a href="api.html">API Reference</a> <span>›</span> <a href="ns-log.html">Log</a> <span>›</span> <span class="here">Log.set_level</span></div>
|
||
<div class="item-head">
|
||
<span class="kind-badge kind-method">method</span>
|
||
<h1 id="top">Log.set_level</h1>
|
||
</div>
|
||
<code class="sig">Log.set_level(n) -> void</code>
|
||
<div class="desc"><p>Sets the logging threshold: only messages whose level is <code>n</code> or higher are written; everything below is silently dropped. The levels are <code>trace</code> 0, <code>debug</code> 1, <code>info</code> 2, <code>warn</code> 3, <code>error</code> 4, so <code>set_level(3)</code> shows only warnings and errors, and the default of <code>0</code> shows everything. Set it once at startup — low in development, high (3, or 5 to silence all) for release — and every call site adjusts automatically. Read the current value back with <a href="log-level"><code>Log.level</code></a>.</p></div>
|
||
<div class="params"><h2>Parameters</h2><div class="param" id="param-n"><code class="pname">n</code><span class="pdesc">the minimum level to show (0–4; use 5 to silence every level)</span></div></div>
|
||
<div class="examples"><h2>Example</h2><pre data-lang="ludic">program Quiet {
|
||
entry {
|
||
Log.set_level(3) # warnings and errors only
|
||
Log.info("startup") # dropped
|
||
Log.warn("low memory") # shown
|
||
}
|
||
}</pre></div>
|
||
|
||
<a class="back" href="api.html">← All symbols</a>
|
||
</main>
|
||
<script src="ludic-highlight.js"></script>
|
||
<script>Ludic.highlightAll(); Ludic.installCards(); Ludic.flashTarget();</script>
|
||
</body></html> |