Skip to content

Commit 8271f72

Browse files
authored
Merge pull request #4 from fullstack-build/development
Update dependencies, add support for circular structures and setting to enable caller name as logger name
2 parents 377cfdc + 28def3f commit 8271f72

27 files changed

+1713
-1443
lines changed
File renamed without changes.

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8
1+
12

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
**Small footprint, blazing performance**<br>
1818
👮‍️ **Fully typed with TypeScript support (exact code position)**<br>
1919
🗃 **_Pretty_ or `JSON` output**<br>
20+
🔄 **Supports _circular_ objects**<br>
2021
🦸 **Custom pluggable loggers**<br>
2122
💅 **Object and error interpolation**<br>
2223
🕵️‍ **Code surrounding error position (_code frame_)**<br>
@@ -178,6 +179,16 @@ giving you the chance to provide each module/package with its own logger and bei
178179
new Logger({ name: "myLogger" });
179180
```
180181

182+
*Additional Setting:*
183+
184+
```setCallerAsLoggerName: false```
185+
186+
When setting to `true` `tslog` will use caller name as the default name of the logger.
187+
188+
```typescript
189+
new Logger({ setCallerAsLoggerName: true });
190+
```
191+
181192
##### `minLevel`
182193
```default: "silly"```
183194

docs/api_extractor/tslog.api.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ export interface ISettings extends ISettingsParam {
9797
// (undocumented)
9898
overwriteConsole: boolean;
9999
// (undocumented)
100+
setCallerAsLoggerName: boolean;
101+
// (undocumented)
100102
stdErr: IStd;
101103
// (undocumented)
102104
stdOut: IStd;
@@ -117,6 +119,7 @@ export interface ISettingsParam {
117119
minLevel?: TLogLevelName;
118120
name?: string;
119121
overwriteConsole?: boolean;
122+
setCallerAsLoggerName?: boolean;
120123
stdErr?: IStd;
121124
stdOut?: IStd;
122125
suppressStdOutput?: boolean;

docs/tsdoc/assets/js/search.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/tsdoc/classes/logger.html

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ <h3>constructor</h3>
121121
<li class="tsd-description">
122122
<aside class="tsd-sources">
123123
<ul>
124-
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/1613e98/src/index.ts#L64">index.ts:64</a></li>
124+
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/bd75ce4/src/index.ts#L65">index.ts:65</a></li>
125125
</ul>
126126
</aside>
127127
<div class="tsd-comment tsd-typography">
@@ -150,7 +150,7 @@ <h3><span class="tsd-flag ts-flagReadonly">Readonly</span> settings</h3>
150150
<div class="tsd-signature tsd-kind-icon">settings<span class="tsd-signature-symbol">:</span> <a href="../interfaces/isettings.html" class="tsd-signature-type">ISettings</a></div>
151151
<aside class="tsd-sources">
152152
<ul>
153-
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/1613e98/src/index.ts#L64">index.ts:64</a></li>
153+
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/bd75ce4/src/index.ts#L65">index.ts:65</a></li>
154154
</ul>
155155
</aside>
156156
<div class="tsd-comment tsd-typography">
@@ -172,7 +172,7 @@ <h3>attach<wbr>Transport</h3>
172172
<li class="tsd-description">
173173
<aside class="tsd-sources">
174174
<ul>
175-
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/1613e98/src/index.ts#L117">index.ts:117</a></li>
175+
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/bd75ce4/src/index.ts#L128">index.ts:128</a></li>
176176
</ul>
177177
</aside>
178178
<div class="tsd-comment tsd-typography">
@@ -209,7 +209,7 @@ <h3>debug</h3>
209209
<li class="tsd-description">
210210
<aside class="tsd-sources">
211211
<ul>
212-
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/1613e98/src/index.ts#L147">index.ts:147</a></li>
212+
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/bd75ce4/src/index.ts#L158">index.ts:158</a></li>
213213
</ul>
214214
</aside>
215215
<div class="tsd-comment tsd-typography">
@@ -240,7 +240,7 @@ <h3>error</h3>
240240
<li class="tsd-description">
241241
<aside class="tsd-sources">
242242
<ul>
243-
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/1613e98/src/index.ts#L171">index.ts:171</a></li>
243+
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/bd75ce4/src/index.ts#L182">index.ts:182</a></li>
244244
</ul>
245245
</aside>
246246
<div class="tsd-comment tsd-typography">
@@ -271,7 +271,7 @@ <h3>fatal</h3>
271271
<li class="tsd-description">
272272
<aside class="tsd-sources">
273273
<ul>
274-
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/1613e98/src/index.ts#L179">index.ts:179</a></li>
274+
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/bd75ce4/src/index.ts#L190">index.ts:190</a></li>
275275
</ul>
276276
</aside>
277277
<div class="tsd-comment tsd-typography">
@@ -302,7 +302,7 @@ <h3>info</h3>
302302
<li class="tsd-description">
303303
<aside class="tsd-sources">
304304
<ul>
305-
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/1613e98/src/index.ts#L155">index.ts:155</a></li>
305+
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/bd75ce4/src/index.ts#L166">index.ts:166</a></li>
306306
</ul>
307307
</aside>
308308
<div class="tsd-comment tsd-typography">
@@ -333,7 +333,7 @@ <h3>silly</h3>
333333
<li class="tsd-description">
334334
<aside class="tsd-sources">
335335
<ul>
336-
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/1613e98/src/index.ts#L131">index.ts:131</a></li>
336+
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/bd75ce4/src/index.ts#L142">index.ts:142</a></li>
337337
</ul>
338338
</aside>
339339
<div class="tsd-comment tsd-typography">
@@ -364,7 +364,7 @@ <h3>trace</h3>
364364
<li class="tsd-description">
365365
<aside class="tsd-sources">
366366
<ul>
367-
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/1613e98/src/index.ts#L139">index.ts:139</a></li>
367+
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/bd75ce4/src/index.ts#L150">index.ts:150</a></li>
368368
</ul>
369369
</aside>
370370
<div class="tsd-comment tsd-typography">
@@ -395,7 +395,7 @@ <h3>warn</h3>
395395
<li class="tsd-description">
396396
<aside class="tsd-sources">
397397
<ul>
398-
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/1613e98/src/index.ts#L163">index.ts:163</a></li>
398+
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/bd75ce4/src/index.ts#L174">index.ts:174</a></li>
399399
</ul>
400400
</aside>
401401
<div class="tsd-comment tsd-typography">

docs/tsdoc/globals.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ <h3>TLog<wbr>Level<wbr>Color</h3>
105105
<div class="tsd-signature tsd-kind-icon">TLog<wbr>Level<wbr>Color<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{}</span></div>
106106
<aside class="tsd-sources">
107107
<ul>
108-
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/1613e98/src/interfaces.ts#L33">interfaces.ts:33</a></li>
108+
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/bd75ce4/src/interfaces.ts#L33">interfaces.ts:33</a></li>
109109
</ul>
110110
</aside>
111111
<div class="tsd-comment tsd-typography">
@@ -125,7 +125,7 @@ <h3>TLog<wbr>Level<wbr>Id</h3>
125125
<div class="tsd-signature tsd-kind-icon">TLog<wbr>Level<wbr>Id<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">keyof </span><a href="interfaces/iloglevel.html" class="tsd-signature-type">ILogLevel</a></div>
126126
<aside class="tsd-sources">
127127
<ul>
128-
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/1613e98/src/interfaces.ts#L21">interfaces.ts:21</a></li>
128+
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/bd75ce4/src/interfaces.ts#L21">interfaces.ts:21</a></li>
129129
</ul>
130130
</aside>
131131
<div class="tsd-comment tsd-typography">
@@ -140,7 +140,7 @@ <h3>TLog<wbr>Level<wbr>Name</h3>
140140
<div class="tsd-signature tsd-kind-icon">TLog<wbr>Level<wbr>Name<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">ILogLevel</span><span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">TLogLevelId</span><span class="tsd-signature-symbol">]</span></div>
141141
<aside class="tsd-sources">
142142
<ul>
143-
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/1613e98/src/interfaces.ts#L27">interfaces.ts:27</a></li>
143+
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/bd75ce4/src/interfaces.ts#L27">interfaces.ts:27</a></li>
144144
</ul>
145145
</aside>
146146
<div class="tsd-comment tsd-typography">
@@ -155,7 +155,7 @@ <h3>TTransport<wbr>Logger</h3>
155155
<div class="tsd-signature tsd-kind-icon">TTransport<wbr>Logger&lt;T&gt;<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{}</span></div>
156156
<aside class="tsd-sources">
157157
<ul>
158-
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/1613e98/src/interfaces.ts#L185">interfaces.ts:185</a></li>
158+
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/bd75ce4/src/interfaces.ts#L189">interfaces.ts:189</a></li>
159159
</ul>
160160
</aside>
161161
<div class="tsd-comment tsd-typography">

docs/tsdoc/index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ <h3>Highlights</h3>
8080
<p><strong>Small footprint, blazing performance</strong><br>
8181
👮‍️ <strong>Fully typed with TypeScript support (exact code position)</strong><br>
8282
🗃 <strong><em>Pretty</em> or <code>JSON</code> output</strong><br>
83+
🔄 <strong>Supports <em>circular</em> structures</strong><br>
8384
🦸 <strong>Custom pluggable loggers</strong><br>
8485
💅 <strong>Object and error interpolation</strong><br>
8586
🕵️‍ <strong>Code surrounding error position (<em>code frame</em>)</strong><br>
@@ -218,6 +219,10 @@ <h5><code>name</code></h5>
218219
This setting is particularly interesting when working in a <code>monorepo</code>,
219220
giving you the chance to provide each module/package with its own logger and being able to distinguish logs coming from different parts of your application. </p>
220221
<pre><code class="language-typescript"><span class="hljs-keyword">new</span> Logger({ name: <span class="hljs-string">"myLogger"</span> });</code></pre>
222+
<p><em>Additional Setting:</em></p>
223+
<p><code>setCallerAsLoggerName: false</code></p>
224+
<p>When setting to <code>true</code> <code>tslog</code> will use caller name as the default name of the logger.</p>
225+
<pre><code class="language-typescript"><span class="hljs-keyword">new</span> Logger({ setCallerAsLoggerName: <span class="hljs-literal">true</span> });</code></pre>
221226
<a href="#minlevel" id="minlevel" style="color: inherit; text-decoration: none;">
222227
<h5><code>minLevel</code></h5>
223228
</a>

docs/tsdoc/interfaces/icodeframe.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ <h3>column<wbr>Number</h3>
103103
<div class="tsd-signature tsd-kind-icon">column<wbr>Number<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span></div>
104104
<aside class="tsd-sources">
105105
<ul>
106-
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/1613e98/src/interfaces.ts#L221">interfaces.ts:221</a></li>
106+
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/bd75ce4/src/interfaces.ts#L225">interfaces.ts:225</a></li>
107107
</ul>
108108
</aside>
109109
</section>
@@ -113,7 +113,7 @@ <h3>first<wbr>Line<wbr>Number</h3>
113113
<div class="tsd-signature tsd-kind-icon">first<wbr>Line<wbr>Number<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
114114
<aside class="tsd-sources">
115115
<ul>
116-
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/1613e98/src/interfaces.ts#L219">interfaces.ts:219</a></li>
116+
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/bd75ce4/src/interfaces.ts#L223">interfaces.ts:223</a></li>
117117
</ul>
118118
</aside>
119119
</section>
@@ -123,7 +123,7 @@ <h3>line<wbr>Number</h3>
123123
<div class="tsd-signature tsd-kind-icon">line<wbr>Number<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
124124
<aside class="tsd-sources">
125125
<ul>
126-
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/1613e98/src/interfaces.ts#L220">interfaces.ts:220</a></li>
126+
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/bd75ce4/src/interfaces.ts#L224">interfaces.ts:224</a></li>
127127
</ul>
128128
</aside>
129129
</section>
@@ -133,7 +133,7 @@ <h3>lines<wbr>After</h3>
133133
<div class="tsd-signature tsd-kind-icon">lines<wbr>After<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></div>
134134
<aside class="tsd-sources">
135135
<ul>
136-
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/1613e98/src/interfaces.ts#L224">interfaces.ts:224</a></li>
136+
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/bd75ce4/src/interfaces.ts#L228">interfaces.ts:228</a></li>
137137
</ul>
138138
</aside>
139139
</section>
@@ -143,7 +143,7 @@ <h3>lines<wbr>Before</h3>
143143
<div class="tsd-signature tsd-kind-icon">lines<wbr>Before<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></div>
144144
<aside class="tsd-sources">
145145
<ul>
146-
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/1613e98/src/interfaces.ts#L222">interfaces.ts:222</a></li>
146+
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/bd75ce4/src/interfaces.ts#L226">interfaces.ts:226</a></li>
147147
</ul>
148148
</aside>
149149
</section>
@@ -153,7 +153,7 @@ <h3>relevant<wbr>Line</h3>
153153
<div class="tsd-signature tsd-kind-icon">relevant<wbr>Line<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
154154
<aside class="tsd-sources">
155155
<ul>
156-
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/1613e98/src/interfaces.ts#L223">interfaces.ts:223</a></li>
156+
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/bd75ce4/src/interfaces.ts#L227">interfaces.ts:227</a></li>
157157
</ul>
158158
</aside>
159159
</section>

docs/tsdoc/interfaces/ierrorobject.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ <h3><span class="tsd-flag ts-flagOptional">Optional</span> code<wbr>Frame</h3>
102102
<div class="tsd-signature tsd-kind-icon">code<wbr>Frame<span class="tsd-signature-symbol">:</span> <a href="icodeframe.html" class="tsd-signature-type">ICodeFrame</a></div>
103103
<aside class="tsd-sources">
104104
<ul>
105-
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/1613e98/src/interfaces.ts#L178">interfaces.ts:178</a></li>
105+
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/bd75ce4/src/interfaces.ts#L182">interfaces.ts:182</a></li>
106106
</ul>
107107
</aside>
108108
<div class="tsd-comment tsd-typography">
@@ -117,7 +117,7 @@ <h3>is<wbr>Error</h3>
117117
<div class="tsd-signature tsd-kind-icon">is<wbr>Error<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">true</span></div>
118118
<aside class="tsd-sources">
119119
<ul>
120-
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/1613e98/src/interfaces.ts#L170">interfaces.ts:170</a></li>
120+
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/bd75ce4/src/interfaces.ts#L174">interfaces.ts:174</a></li>
121121
</ul>
122122
</aside>
123123
<div class="tsd-comment tsd-typography">
@@ -132,7 +132,7 @@ <h3>message</h3>
132132
<div class="tsd-signature tsd-kind-icon">message<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
133133
<aside class="tsd-sources">
134134
<ul>
135-
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/1613e98/src/interfaces.ts#L174">interfaces.ts:174</a></li>
135+
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/bd75ce4/src/interfaces.ts#L178">interfaces.ts:178</a></li>
136136
</ul>
137137
</aside>
138138
<div class="tsd-comment tsd-typography">
@@ -147,7 +147,7 @@ <h3>name</h3>
147147
<div class="tsd-signature tsd-kind-icon">name<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
148148
<aside class="tsd-sources">
149149
<ul>
150-
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/1613e98/src/interfaces.ts#L172">interfaces.ts:172</a></li>
150+
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/bd75ce4/src/interfaces.ts#L176">interfaces.ts:176</a></li>
151151
</ul>
152152
</aside>
153153
<div class="tsd-comment tsd-typography">
@@ -162,7 +162,7 @@ <h3>stack</h3>
162162
<div class="tsd-signature tsd-kind-icon">stack<span class="tsd-signature-symbol">:</span> <a href="istackframe.html" class="tsd-signature-type">IStackFrame</a><span class="tsd-signature-symbol">[]</span></div>
163163
<aside class="tsd-sources">
164164
<ul>
165-
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/1613e98/src/interfaces.ts#L176">interfaces.ts:176</a></li>
165+
<li>Defined in <a href="https://github.com/fullstack-build/tslog/blob/bd75ce4/src/interfaces.ts#L180">interfaces.ts:180</a></li>
166166
</ul>
167167
</aside>
168168
<div class="tsd-comment tsd-typography">

0 commit comments

Comments
 (0)