ethers.js/docs/v5/api/utils/logger/index.html
2020-06-12 19:21:37 -04:00

140 lines
31 KiB
HTML

<!DOCTYPE html>
<html class="paged">
<head>
<title>Logging</title>
<link rel="stylesheet" type="text/css" href="/v5/static/style.css">
</head>
<body>
<div class="sidebar">
<div class="header">
<div class="logo"><a href="/v5/"><div class="image"></div><div class="name">ethers</div><div class="version">v5.0-beta</div></a></div>
</div>
<div class="toc"><div>
<div class="link title"><a href="/v5/">Documentation</a></div><div class="base show link depth-1"><a href="/v5/getting-started/">Getting Started</a></div><div class="base show link depth-1"><a href="/v5/concepts/">Ethereum Basics</a></div><div class="hide link depth-2"><a href="/v5/concepts/events/">Events</a></div><div class="hide link depth-2"><a href="/v5/concepts/gas/">Gas</a></div><div class="hide link depth-2"><a href="/v5/concepts/security/">Security</a></div><div class="base ancestor show link depth-1"><a href="/v5/api/">Application Programming Interface</a></div><div class="show link depth-2"><a href="/v5/api/contract/">Contract Interaction</a></div><div class="hide link depth-3"><a href="/v5/api/contract/contract/">Contract</a></div><div class="hide link depth-3"><a href="/v5/api/contract/contract-factory/">ContractFactory</a></div><div class="hide link depth-3"><a href="/v5/api/contract/example/">Example: ERC-20 Contract</a></div><div class="show link depth-2"><a href="/v5/api/signer/">Signers</a></div><div class="show link depth-2"><a href="/v5/api/providers/">Providers</a></div><div class="hide link depth-3"><a href="/v5/api/providers/provider/">Provider</a></div><div class="hide link depth-3"><a href="/v5/api/providers/jsonrpc-provider/">JsonRpcProvider</a></div><div class="hide link depth-3"><a href="/v5/api/providers/api-providers/">API Providers</a></div><div class="hide link depth-3"><a href="/v5/api/providers/other/">Other Providers</a></div><div class="hide link depth-3"><a href="/v5/api/providers/types/">Types</a></div><div class="ancestor show link depth-2"><a href="/v5/api/utils/">Utilities</a></div><div class="show link depth-3"><a href="/v5/api/utils/abi/">Application Binary Interface</a></div><div class="hide link depth-4"><a href="/v5/api/utils/abi/coder/">AbiCoder</a></div><div class="hide link depth-4"><a href="/v5/api/utils/abi/formats/">ABI Formats</a></div><div class="hide link depth-4"><a href="/v5/api/utils/abi/fragments/">Fragments</a></div><div class="hide link depth-4"><a href="/v5/api/utils/abi/interface/">Interface</a></div><div class="show link depth-3"><a href="/v5/api/utils/address/">Addresses</a></div><div class="show link depth-3"><a href="/v5/api/utils/bignumber/">BigNumber</a></div><div class="show link depth-3"><a href="/v5/api/utils/bytes/">Byte Manipulation</a></div><div class="show link depth-3"><a href="/v5/api/utils/constants/">Constants</a></div><div class="show link depth-3"><a href="/v5/api/utils/display-logic/">Display Logic and Input</a></div><div class="show link depth-3"><a href="/v5/api/utils/encoding/">Encoding Utilities</a></div><div class="show link depth-3"><a href="/v5/api/utils/fixednumber/">FixedNumber</a></div><div class="show link depth-3"><a href="/v5/api/utils/hashing/">Hashing Algorithms</a></div><div class="show link depth-3"><a href="/v5/api/utils/hdnode/">HD Wallet</a></div><div class="myself ancestor ancestor show link depth-3"><a href="/v5/api/utils/logger/">Logging</a></div><div class="show link depth-3"><a href="/v5/api/utils/properties/">Property Utilities</a></div><div class="show link depth-3"><a href="/v5/api/utils/signing-key/">Signing Key</a></div><div class="show link depth-3"><a href="/v5/api/utils/strings/">Strings</a></div><div class="show link depth-3"><a href="/v5/api/utils/transactions/">Transactions</a></div><div class="show link depth-3"><a href="/v5/api/utils/web/">Web Utilities</a></div><div class="show link depth-3"><a href="/v5/api/utils/wordlists/">Wordlists</a></div><div class="show link depth-2"><a href="/v5/api/other/">Other Libraries</a></div><div class="hide link depth-3"><a href="/v5/api/other/assembly/">Assembly</a></div><div class="hide link depth-4"><a href="/v5/api/other/assembly/dialect/">Ethers ASM Dialect</a></div><div class="hide link depth-4"><a href="/v5/api/other/assembly/api/">Utilities</a></div><div class="hide link depth-4"><a href="/v5/api/other/assembly/ast/">Abstract Syntax Tree</a></div><div class="hide link depth-3"><a href="/v5/api/other/hardware/">Hardware Wallets</a></div><div class="show link depth-2"><a href="/v5/api/experimental/">Experimental</a></div><div class="base show link depth-1"><a href="/v5/cli/">Command Line Interfaces</a></div><div class="hide link depth-2"><a href="/v5/cli/ethers/">Sandbox Utility</a></div><div class="hide link depth-2"><a href="/v5/cli/asm/">Assembler</a></div><div class="hide link depth-2"><a href="/v5/cli/ens/">Ethereum Naming Service</a></div><div class="hide link depth-2"><a href="/v5/cli/typescript/">TypeScript</a></div><div class="hide link depth-2"><a href="/v5/cli/plugin/">Making Your Own</a></div><div class="base show link depth-1"><a href="/v5/cookbook/">Cookbook</a></div><div class="base show link depth-1"><a href="/v5/migration/">Migration Guide</a></div><div class="hide link depth-2"><a href="/v5/migration/web3/">Migration: From Web3.js</a></div><div class="hide link depth-2"><a href="/v5/migration/ethers-v4/">Migration: From Ethers v4</a></div><div class="base show link depth-1"><a href="/v5/testing/">Testing</a></div><div class="base show link depth-1"><a href="/v5/contributing/">Contributing and Hacking</a></div><div class="base show link depth-1"><a href="/v5/documentation/">Flatworm Docs</a></div><div class="base show link depth-1"><a href="/v5/license/">License and Copyright</a></div>
</div></div>
</div>
<div class="content">
<div class="breadcrumbs"><a href="/v5/">Documentation</a>&nbsp;&nbsp;&raquo;&nbsp;&nbsp;<a href="/v5/api/">API</a>&nbsp;&nbsp;&raquo;&nbsp;&nbsp;<a href="/v5/api/utils/">Utilities</a>&nbsp;&nbsp;&raquo;&nbsp;&nbsp;<span class="current">Logging</span></div>
<a name="logging"></a><a name="logging"></a><h1 class="show-anchors"><div>Logging<div class="anchors"><a class="self" href="/v5/api/utils/logger/#logging"></a></div></div></h1><p>These are just a few simple logging utilities provided to simplify and standardize the error facilities across the Ethers library.</p>
<p>The <a href="/v5/api/utils/logger/#Logger">Logger</a> library has zero dependencies and is intentionally very light so it can be easily included in each library.</p>
<p>The <a href="/v5/api/utils/logger/#Logger--censorship">Censorship</a> functionality relies on one instance of the Ethers library being included. In large bundled packages or when <code class="inline">npm link</code> is used, this may not be the case. If you require this functionality, ensure that your bundling is configured properly.</p>
<a name="Logger"></a><a name="logging--Logger"></a><h2 class="show-anchors"><div>Logger<div class="anchors"><a class="self" href="/v5/api/utils/logger/#Logger"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/logger/src.ts/index.ts#L142">source</a></div></div></h2>
<div class="property show-anchors"><div class="signature"><span class="modifier">new </span><span class="path">ethers</span><span class="symbol">.</span><span class="path">utils</span><span class="symbol">.</span><span class="method">Logger</span><span class="symbol">(</span> <span class="param">version</span> <span class="symbol">)</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/logger/src.ts/index.ts#L149">source</a></div></div><div class="body"><p>Create a new logger which will include <i>version</i> in all errors thrown.</p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">Logger</span><span class="symbol">.</span><span class="method">globalLogger</span><span class="symbol">(</span> <span class="symbol">)</span> <span class="arrow">&rArr;</span> <span class="returns"><a href="/v5/api/utils/logger/#Logger">Logger</a></span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/logger/src.ts/index.ts#L297">source</a></div></div><div class="body"><p>Returns the singleton global logger.</p>
</div></div><a name="logging--Logger--logging-output"></a><h3 class="show-anchors"><div>Logging Output<div class="anchors"><a class="self" href="/v5/api/utils/logger/#logging--Logger--logging-output"></a></div></div></h3>
<div class="property show-anchors"><div class="signature"><span class="path">logger</span><span class="symbol">.</span><span class="method">debug</span><span class="symbol">(</span> ...<span class="param">args</span> <span class="symbol">)</span> <span class="arrow">&rArr;</span> <span class="returns">void</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/logger/src.ts/index.ts#L166">source</a></div></div><div class="body"><p>Log debugging information.</p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">logger</span><span class="symbol">.</span><span class="method">info</span><span class="symbol">(</span> ...<span class="param">args</span> <span class="symbol">)</span> <span class="arrow">&rArr;</span> <span class="returns">void</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/logger/src.ts/index.ts#L170">source</a></div></div><div class="body"><p>Log generic information.</p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">logger</span><span class="symbol">.</span><span class="method">warn</span><span class="symbol">(</span> ...<span class="param">args</span> <span class="symbol">)</span> <span class="arrow">&rArr;</span> <span class="returns">void</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/logger/src.ts/index.ts#L174">source</a></div></div><div class="body"><p>Log warnings.</p>
</div></div><a name="logging--Logger--errors"></a><h3 class="show-anchors"><div>Errors<div class="anchors"><a class="self" href="/v5/api/utils/logger/#logging--Logger--errors"></a></div></div></h3><p>These functions honor the current <a href="/v5/api/utils/logger/#Logger--censorship">Censorship</a> and help create a standard error model for detecting and processing errors within Ethers.</p>
<div class="property show-anchors"><div class="signature"><span class="path">logger</span><span class="symbol">.</span><span class="method">makeError</span><span class="symbol">(</span> <span class="param">message</span> <span class="symbol">[</span> <span class="symbol">,</span> <span class="param">code</span> = <span class="param">UNKNOWN_ERROR</span> <span class="symbol">[</span> <span class="symbol">,</span> <span class="param">params</span> <span class="symbol">]</span> <span class="symbol">]</span> <span class="symbol">)</span> <span class="arrow">&rArr;</span> <span class="returns">Error</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/logger/src.ts/index.ts#L178">source</a></div></div><div class="body"><p>Create an Error object with <i>message</i> and an optional <i>code</i> and additional <i>params</i> set. This is useful when an error is needed to be rejected instead of thrown.</p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">logger</span><span class="symbol">.</span><span class="method">throwError</span><span class="symbol">(</span> <span class="param">message</span> <span class="symbol">[</span> <span class="symbol">,</span> <span class="param">code</span> = <span class="param">UNKNOWN_ERROR</span> <span class="symbol">[</span> <span class="symbol">,</span> <span class="param">params</span> <span class="symbol">]</span> <span class="symbol">]</span> <span class="symbol">)</span> <span class="arrow">&rArr;</span> <span class="returns">never</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/logger/src.ts/index.ts#L215">source</a></div></div><div class="body"><p>Throw an Error with <i>message</i> and an optional <i>code</i> and additional <i>params</i> set.</p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">logger</span><span class="symbol">.</span><span class="method">throwArgumentError</span><span class="symbol">(</span> <span class="param">message</span> <span class="symbol">,</span> <span class="param">name</span> <span class="symbol">,</span> <span class="param">value</span> <span class="symbol">)</span> <span class="arrow">&rArr;</span> <span class="returns">never</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/logger/src.ts/index.ts#L219">source</a></div></div><div class="body"><p>Throw an <a href="/v5/api/utils/logger/#errors-InvalidArgument">INVALID_ARGUMENT</a> Error with <i>name</i> and <i>value</i>.</p>
</div></div><a name="logging--Logger--usage-validation"></a><h3 class="show-anchors"><div>Usage Validation<div class="anchors"><a class="self" href="/v5/api/utils/logger/#logging--Logger--usage-validation"></a></div></div></h3><p>There can be used to ensure various properties and actions are safe.</p>
<div class="property show-anchors"><div class="signature"><span class="path">logger</span><span class="symbol">.</span><span class="method">checkAbstract</span><span class="symbol">(</span> <span class="param">target</span> <span class="symbol">,</span> <span class="param">kind</span> <span class="symbol">)</span> <span class="arrow">&rArr;</span> <span class="returns">void</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/logger/src.ts/index.ts#L285">source</a></div></div><div class="body"><p>Checks that <i>target</i> is not <i>kind</i> and performs the same operatons as <code class="inline">checkNew</code>. This is useful for ensuring abstract classes are not being instantiated.</p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">logger</span><span class="symbol">.</span><span class="method">checkArgumentCount</span><span class="symbol">(</span> <span class="param">count</span> <span class="symbol">,</span> <span class="param">expectedCound</span> <span class="symbol">[</span> <span class="symbol">,</span> <span class="param">message</span> <span class="symbol">)</span> <span class="arrow">&rArr;</span> <span class="returns">void</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/logger/src.ts/index.ts#L257">source</a></div></div><div class="body"><p>If <i>count</i> is not equal to <i>expectedCount</i>, throws a <a href="/v5/api/utils/logger/#errors-MissingArgument">MISSING_ARGUMENT</a> or <a href="/v5/api/utils/logger/#errors-UnexpectedArgument">UNEXPECTED_ARGUMENT</a> error.</p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">logger</span><span class="symbol">.</span><span class="method">checkNew</span><span class="symbol">(</span> <span class="param">target</span> <span class="symbol">,</span> <span class="param">kind</span> <span class="symbol">)</span> <span class="arrow">&rArr;</span> <span class="returns">void</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/logger/src.ts/index.ts#L279">source</a></div></div><div class="body"><p>If <i>target</i> is not a valid <code class="inline">this</code> or <code class="inline">target</code> value, throw a <a href="/v5/api/utils/logger/#errors-MissingNew">MISSING_NEW</a> error. This is useful to ensure callers of a Class are using <code class="inline">new</code>.</p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">logger</span><span class="symbol">.</span><span class="method">checkNormalize</span><span class="symbol">(</span> <span class="param">message</span> <span class="symbol">)</span> <span class="arrow">&rArr;</span> <span class="returns">void</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/logger/src.ts/index.ts#L226">source</a></div></div><div class="body"><p>Check that the environment has a correctly functioning <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize">String.normalize</a>. If not, a <a href="/v5/api/utils/logger/#errors-UnsupportedOperation">UNSUPPORTED_OPERATION</a> error is thrown.</p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">logger</span><span class="symbol">.</span><span class="method">checkSafeUint53</span><span class="symbol">(</span> <span class="param">value</span> <span class="symbol">[</span> <span class="symbol">,</span> <span class="param">message</span> <span class="symbol">]</span> <span class="symbol">)</span> <span class="arrow">&rArr;</span> <span class="returns">void</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/logger/src.ts/index.ts#L235">source</a></div></div><div class="body"><p>If <i>value</i> is not safe as a <a href="https://en.wikipedia.org/wiki/Double-precision_floating-point_format">JavaScript number</a>, throws a <a href="/v5/api/utils/logger/#errors-NumericFault">NUMERIC_FAULT</a> error.</p>
</div></div><a name="Logger--censorship"></a><a name="logging--Logger--Logger--censorship"></a><h3 class="show-anchors"><div>Censorship<div class="anchors"><a class="self" href="/v5/api/utils/logger/#Logger--censorship"></a></div></div></h3>
<div class="property show-anchors"><div class="signature"><span class="path">Logger</span><span class="symbol">.</span><span class="method">setCensorship</span><span class="symbol">(</span> <span class="param">censor</span> <span class="symbol">[</span> <span class="symbol">,</span> <span class="param">permanent</span> = <span class="param">false</span> <span class="symbol">]</span> <span class="symbol">)</span> <span class="arrow">&rArr;</span> <span class="returns">void</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/logger/src.ts/index.ts#L302">source</a></div></div><div class="body"><p>Set error censorship, optionally preventing errors from being uncensored.</p>
<p>In production applications, this prevents any error from leaking information by masking the message and values of errors.</p>
<p>This can impact debugging, making it substantially more difficult.</p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">Logger</span><span class="symbol">.</span><span class="method">setLogLevel</span><span class="symbol">(</span> <span class="param">logLevel</span> <span class="symbol">)</span> <span class="arrow">&rArr;</span> <span class="returns">void</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/logger/src.ts/index.ts#L320">source</a></div></div><div class="body"><p>Set the log level, to suppress logging output below a <a href="/v5/api/utils/logger/#Logger-levels">particular log level</a>.</p>
</div></div><a name="errors"></a><a name="logging--errors"></a><h2 class="show-anchors"><div>Errors<div class="anchors"><a class="self" href="/v5/api/utils/logger/#errors"></a></div></div></h2><p>Every error in Ethers has a <code class="inline">code</code> value, which is a string that will match one of the following error codes.</p>
<a name="logging--errors--generic-error-codes"></a><h3 class="show-anchors"><div>Generic Error Codes<div class="anchors"><a class="self" href="/v5/api/utils/logger/#logging--errors--generic-error-codes"></a></div></div></h3>
<div class="property show-anchors"><div class="signature"><span class="path">Logger</span><span class="symbol">.</span><span class="path">errors</span><span class="symbol">.</span><span class="method">NOT_IMPLEMENTED</span><div class="anchors"></div></div><div class="body"><p>The operation is not implemented.</p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">Logger</span><span class="symbol">.</span><span class="path">errors</span><span class="symbol">.</span><span class="method">SERVER_ERROR</span><div class="anchors"></div></div><div class="body"><p>There was an error communicating with a server.</p>
</div></div><a name="errors-Timeout"></a><div class="property show-anchors"><div class="signature"><span class="path">Logger</span><span class="symbol">.</span><span class="path">errors</span><span class="symbol">.</span><span class="method">TIMEOUT</span><div class="anchors"><a class="self" href="/v5/api/utils/logger/#errors-Timeout"></a></div></div><div class="body"><p>A timeout occurred.</p>
</div></div><a name="errors-UnknownError"></a><div class="property show-anchors"><div class="signature"><span class="path">Logger</span><span class="symbol">.</span><span class="path">errors</span><span class="symbol">.</span><span class="method">UNKNOWN_ERROR</span><div class="anchors"><a class="self" href="/v5/api/utils/logger/#errors-UnknownError"></a></div></div><div class="body"><p>A generic unknown error.</p>
</div></div><a name="errors-UnsupportedOperation"></a><div class="property show-anchors"><div class="signature"><span class="path">Logger</span><span class="symbol">.</span><span class="path">errors</span><span class="symbol">.</span><span class="method">UNSUPPORTED_OPERATION</span><div class="anchors"><a class="self" href="/v5/api/utils/logger/#errors-UnsupportedOperation"></a></div></div><div class="body"><p>The operation is not supported.</p>
</div></div><a name="logging--errors--safety-error-codes"></a><h3 class="show-anchors"><div>Safety Error Codes<div class="anchors"><a class="self" href="/v5/api/utils/logger/#logging--errors--safety-error-codes"></a></div></div></h3>
<div class="property show-anchors"><div class="signature"><span class="path">Logger</span><span class="symbol">.</span><span class="path">errors</span><span class="symbol">.</span><span class="method">BUFFER_OVERRUN</span><div class="anchors"></div></div><div class="body"><p>The amount of data needed is more than the amount of data required, which would cause the data buffer to read past its end.</p>
</div></div><a name="errors-NumericFault"></a><div class="property show-anchors"><div class="signature"><span class="path">Logger</span><span class="symbol">.</span><span class="path">errors</span><span class="symbol">.</span><span class="method">NUMERIC_FAULT</span><div class="anchors"><a class="self" href="/v5/api/utils/logger/#errors-NumericFault"></a></div></div><div class="body"><p>There was an invalid operation done on numeric values.</p>
<p>Common cases of this occur when there is <a href="https://en.wikipedia.org/wiki/Integer_overflow">overflow</a>, <a href="https://en.wikipedia.org/wiki/Arithmetic_underflow">arithmetic underflow</a> in fixed numeric types or division by zero.</p>
</div></div><a name="logging--errors--usage-error-codes"></a><h3 class="show-anchors"><div>Usage Error Codes<div class="anchors"><a class="self" href="/v5/api/utils/logger/#logging--errors--usage-error-codes"></a></div></div></h3>
<a name="errors-InvalidArgument"></a><div class="property show-anchors"><div class="signature"><span class="path">Logger</span><span class="symbol">.</span><span class="path">errors</span><span class="symbol">.</span><span class="method">INVALID_ARGUMENT</span><div class="anchors"><a class="self" href="/v5/api/utils/logger/#errors-InvalidArgument"></a></div></div><div class="body"><p>The type or value of an argument is invalid. This will generally also include the <code class="inline">name</code> and <code class="inline">value</code> of the argument. Any function which accepts sensitive data (such as a private key) will include the string <code class="inline">[[REDACTED]]</code> instead of the value passed in.</p>
</div></div><a name="errors-MissingArgument"></a><div class="property show-anchors"><div class="signature"><span class="path">Logger</span><span class="symbol">.</span><span class="path">errors</span><span class="symbol">.</span><span class="method">MISSING_ARGUMENT</span><div class="anchors"><a class="self" href="/v5/api/utils/logger/#errors-MissingArgument"></a></div></div><div class="body"><p>An expected parameter was not specified.</p>
</div></div><a name="errors-MissingNew"></a><div class="property show-anchors"><div class="signature"><span class="path">Logger</span><span class="symbol">.</span><span class="path">errors</span><span class="symbol">.</span><span class="method">MISSING_NEW</span><div class="anchors"><a class="self" href="/v5/api/utils/logger/#errors-MissingNew"></a></div></div><div class="body"><p>An object is a Class, but is now being called with <code class="inline">new</code>.</p>
</div></div><a name="errors-UnexpectedArgument"></a><div class="property show-anchors"><div class="signature"><span class="path">Logger</span><span class="symbol">.</span><span class="path">errors</span><span class="symbol">.</span><span class="method">UNEXPECTED_ARGUMENT</span><div class="anchors"><a class="self" href="/v5/api/utils/logger/#errors-UnexpectedArgument"></a></div></div><div class="body"><p>Too many parameters we passed into a function.</p>
</div></div><a name="logging--errors--ethereum-error-codes"></a><h3 class="show-anchors"><div>Ethereum Error Codes<div class="anchors"><a class="self" href="/v5/api/utils/logger/#logging--errors--ethereum-error-codes"></a></div></div></h3>
<div class="property show-anchors"><div class="signature"><span class="path">Logger</span><span class="symbol">.</span><span class="path">errors</span><span class="symbol">.</span><span class="method">CALL_EXCEPTION</span><div class="anchors"></div></div><div class="body"><p>An attempt to call a blockchain contract (getter) resulted in a revert or other error.</p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">Logger</span><span class="symbol">.</span><span class="path">errors</span><span class="symbol">.</span><span class="method">INSUFFICIENT_FUNDS</span><div class="anchors"></div></div><div class="body"><p>The account is attempting to make a transaction which costs more than is available.</p>
<p>A sending account must have enough ether to pay for the value, the gas limit (at the gas price) as well as the intrinsic cost of data. The intrinsic cost of data is 4 gas for each zero byte and 68 gas for each non-zero byte.</p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">Logger</span><span class="symbol">.</span><span class="path">errors</span><span class="symbol">.</span><span class="method">NETWORK_ERROR</span><div class="anchors"></div></div><div class="body"><p>An Ethereum network validation error, such as an invalid chain ID.</p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">Logger</span><span class="symbol">.</span><span class="path">errors</span><span class="symbol">.</span><span class="method">NONCE_EXPIRED</span><div class="anchors"></div></div><div class="body"><p>The nonce being specified has already been used in a mined transaction.</p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">Logger</span><span class="symbol">.</span><span class="path">errors</span><span class="symbol">.</span><span class="method">REPLACEMENT_UNDERPRICED</span><div class="anchors"></div></div><div class="body"><p>When replacing a transaction, by using a nonce which has already been sent to the network, but which has not been mined yet the new transaction must specify a higher gas price.</p>
<p>This error occurs when the gas price is insufficient to <i>bribe</i> the transaction pool to prefer the new transaction over the old one. Generally, the new gas price should be about 50% + 1 wei more, so if a gas price of 10 gwei was used, the replacement should be 15.000000001 gwei.</p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">Logger</span><span class="symbol">.</span><span class="path">errors</span><span class="symbol">.</span><span class="method">UNPREDICTABLE_GAS_LIMIT</span><div class="anchors"></div></div><div class="body"><p>When estimating the required amount of gas for a transaction, a node is queried for its best guess.</p>
<p>If a node is unable (or unwilling) to predict the cost, this error occurs.</p>
<p>The best remedy for this situation is to specify a gas limit in the transaction manually.</p>
<p>This error can also indicate that the transaction is expected to fail regardless, if for example an account with no tokens is attempting to send a token.</p>
</div></div><a name="Logger-levels"></a><a name="logging--Logger-levels"></a><h2 class="show-anchors"><div>Log Levels<div class="anchors"><a class="self" href="/v5/api/utils/logger/#Logger-levels"></a></div></div></h2>
<div class="property show-anchors"><div class="signature"><span class="path">Logger</span><span class="symbol">.</span><span class="path">levels</span><span class="symbol">.</span><span class="method">DEBUG</span><div class="anchors"></div></div><div class="body"><p>Log all output, including debugging information.</p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">Logger</span><span class="symbol">.</span><span class="path">levels</span><span class="symbol">.</span><span class="method">INFO</span><div class="anchors"></div></div><div class="body"><p>Only log output for infomational, warnings and errors.</p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">Logger</span><span class="symbol">.</span><span class="path">levels</span><span class="symbol">.</span><span class="method">WARNING</span><div class="anchors"></div></div><div class="body"><p>Only log output for warnings and errors.</p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">Logger</span><span class="symbol">.</span><span class="path">levels</span><span class="symbol">.</span><span class="method">ERROR</span><div class="anchors"></div></div><div class="body"><p>Only log output for errors.</p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">Logger</span><span class="symbol">.</span><span class="path">levels</span><span class="symbol">.</span><span class="method">OFF</span><div class="anchors"></div></div><div class="body"><p>Do not output any logs.</p>
</div></div>
<div class="footer">
<div class="nav previous"><a href="/v5/api/utils/hdnode/"><span class="arrow">&larr;</span>HD Wallet</a></div>
<div class="nav next"><a href="/v5/api/utils/properties/">Property Utilities<span class="arrow">&rarr;</span></a></div>
</div>
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Last modified on June 12, 2020, 7:17pm.</div>
</div>
<script src="/v5/static/script.js" type="text/javascript"></script>
</body>
</html>