<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sidhant Panda</title>
    <description>The latest articles on DEV Community by Sidhant Panda (@sidhantpanda).</description>
    <link>https://dev.to/sidhantpanda</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F31877%2Ff90a107a-e6d7-4594-a472-00fe30399e9b.png</url>
      <title>DEV Community: Sidhant Panda</title>
      <link>https://dev.to/sidhantpanda</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sidhantpanda"/>
    <language>en</language>
    <item>
      <title>Claude might be saturating your machine</title>
      <dc:creator>Sidhant Panda</dc:creator>
      <pubDate>Thu, 16 Jul 2026 17:53:53 +0000</pubDate>
      <link>https://dev.to/sidhantpanda/claude-might-be-saturating-your-machine-3h07</link>
      <guid>https://dev.to/sidhantpanda/claude-might-be-saturating-your-machine-3h07</guid>
      <description>&lt;p&gt;My laptop was sitting idle with the fan at full tilt. Nothing was running that I knew of. The culprit turned out to be ten orphaned busy-loops left behind by a Claude Code session two days earlier.&lt;/p&gt;

&lt;h2&gt;
  
  
  Just fix it for me
&lt;/h2&gt;

&lt;p&gt;If your fan is roaring right now and you would rather not read the rest, paste this into a Claude Code session:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;My machine seems idle but the fan is at full speed. Check the load average against my core count, then list the top CPU consumers with their PPID, elapsed time, and full argument list. I am looking for orphaned processes: anything reparented to PID 1 that has been burning CPU for hours or days, especially shells and interpreters where the process name alone tells you nothing. Show me what you find and what each one actually is before killing anything, and let me confirm the list first.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The "show me before killing" part is the important bit, and it is why the prompt is written that way rather than as "find and kill whatever is using CPU." A long-running process pinned to PID 1 is a strong hint that something was abandoned, but it is not proof. Daemons legitimately live there, and your own &lt;code&gt;nohup&lt;/code&gt;'d job or a detached build will look identical from a distance. Read the argument list before you agree to anything. In my case the arguments made it obvious in about two seconds.&lt;/p&gt;

&lt;h2&gt;
  
  
  Finding it
&lt;/h2&gt;

&lt;p&gt;Start with the load average. This is a 10-core machine:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;uptime&lt;/span&gt;
&lt;span class="go"&gt;19:39  up 6 days,  6:14, 10 users, load averages: 122.91 167.84 162.08
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Load 122 on 10 cores is not idle. Next, the top CPU consumers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;ps &lt;span class="nt"&gt;-Ao&lt;/span&gt; pcpu,pid,ppid,user,comm &lt;span class="nt"&gt;-r&lt;/span&gt; | &lt;span class="nb"&gt;head&lt;/span&gt; &lt;span class="nt"&gt;-12&lt;/span&gt;
&lt;span class="go"&gt; %CPU   PID  PPID USER   COMM
139.8  8320     1 user   /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
 60.9 94281     1 user   /bin/zsh
 59.4 94279     1 user   /bin/zsh
 59.4 94288     1 user   /bin/zsh
 59.1 94287     1 user   /bin/zsh
 57.9 94285     1 user   /bin/zsh
 57.6 94284     1 user   /bin/zsh
 57.6 94286     1 user   /bin/zsh
 57.3 94283     1 user   /bin/zsh
 55.9 94282     1 user   /bin/zsh
 51.1 94280     1 user   /bin/zsh
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ten &lt;code&gt;zsh&lt;/code&gt; processes at roughly 60% each, and every one has &lt;code&gt;PPID 1&lt;/code&gt;. That is the tell: their parent died and &lt;code&gt;launchd&lt;/code&gt; adopted them. &lt;code&gt;comm&lt;/code&gt; only gives you the binary name, so pull the full argument list to see what they actually are:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;ps &lt;span class="nt"&gt;-o&lt;/span&gt; pid,lstart,etime,pcpu,args &lt;span class="nt"&gt;-p&lt;/span&gt; 94279,94280,94281
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note the comma-separated list. Passing &lt;code&gt;-p&lt;/code&gt; alongside &lt;code&gt;-A&lt;/code&gt; silently gets you every process on the box instead.&lt;/p&gt;

&lt;p&gt;The arguments explained everything:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/bin/zsh &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="nb"&gt;source&lt;/span&gt; ~/.claude/shell-snapshots/snapshot-zsh-XXXX.sh 2&amp;gt;/dev/null &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nb"&gt;true&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;eval&lt;/span&gt; &lt;span class="s1"&gt;'
SP=/private/tmp/claude-501/&amp;lt;project&amp;gt;/&amp;lt;session-id&amp;gt;/scratchpad
# saturate all cores, then run the suite under contention
NCPU=$(sysctl -n hw.ncpu)
for i in $(seq 1 $NCPU); do (while :; do :; done) &amp;amp; done
LOADPIDS=$(jobs -p)
pnpm test:integration &amp;gt; "$SP/load.log" 2&amp;gt;&amp;amp;1
kill $LOADPIDS 2&amp;gt;/dev/null
...'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Elapsed time was &lt;code&gt;01-22:41:17&lt;/code&gt;. Just under two days of &lt;code&gt;while :; do :; done&lt;/code&gt; on every core.&lt;/p&gt;

&lt;p&gt;A previous session had deliberately pegged all ten cores to run an integration suite under CPU contention, then meant to clean up after itself. The test run itself was long gone, confirmed by the absence of any &lt;code&gt;vitest&lt;/code&gt; or &lt;code&gt;pnpm&lt;/code&gt; process:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;ps &lt;span class="nt"&gt;-Ao&lt;/span&gt; pid,ppid,pcpu,etime,comm | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-Ei&lt;/span&gt; &lt;span class="s2"&gt;"[n]ode|[v]itest|[p]npm"&lt;/span&gt;
&lt;span class="go"&gt;58938 58933   0.0    00:59 .../bin/node
88656 88648   0.0 02-00:57:58 .../bin/node
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Only the spinners were left. They accounted for about 700% of the 850% total CPU in use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;ps &lt;span class="nt"&gt;-Ao&lt;/span&gt; pid,ppid,pcpu,comm | &lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="s1"&gt;'NR&amp;gt;1 &amp;amp;&amp;amp; $3&amp;gt;20 {sum+=$3; n++} END {print "procs &amp;gt;20% CPU:", n, " total %CPU:", sum}'&lt;/span&gt;
&lt;span class="gp"&gt;procs &amp;gt;&lt;/span&gt;20% CPU: 12  total %CPU: 850.3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Why the cleanup failed
&lt;/h2&gt;

&lt;p&gt;Two things went wrong, and either alone would have been enough.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;LOADPIDS=$(jobs -p)&lt;/code&gt; was the first. Job control is off in a non-interactive shell, so &lt;code&gt;jobs -p&lt;/code&gt; returned nothing and the cleanup &lt;code&gt;kill&lt;/code&gt; had no arguments to act on. Collect &lt;code&gt;$!&lt;/code&gt; after each background spawn instead:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;LOADPIDS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;
&lt;span class="k"&gt;for &lt;/span&gt;i &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;seq &lt;/span&gt;1 &lt;span class="nv"&gt;$NCPU&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
  &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="k"&gt;while&lt;/span&gt; :&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; :&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;done&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &amp;amp;
  &lt;span class="nv"&gt;LOADPIDS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$LOADPIDS&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$!&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="k"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The second is that the parent shell died before reaching the &lt;code&gt;kill&lt;/code&gt; line at all. A cleanup step on the happy path is not cleanup. Use a trap so it fires even on interrupt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;trap&lt;/span&gt; &lt;span class="s1"&gt;'kill $LOADPIDS 2&amp;gt;/dev/null'&lt;/span&gt; EXIT INT TERM
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Fixing it
&lt;/h2&gt;

&lt;p&gt;Plain &lt;code&gt;kill&lt;/code&gt; was enough. No &lt;code&gt;-9&lt;/code&gt; needed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;kill &lt;/span&gt;94279 94280 94281 94282 94283 94284 94285 94286 94287 94288
&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;ps &lt;span class="nt"&gt;-o&lt;/span&gt; &lt;span class="nv"&gt;pid&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; 94279,94280,94281,94282,94283,94284,94285,94286,94287,94288 | &lt;span class="nb"&gt;wc&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt;
&lt;span class="go"&gt;0
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Afterwards, Chrome was back on top where it belongs and nothing else broke 30%:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;ps &lt;span class="nt"&gt;-Ao&lt;/span&gt; pcpu,pid,comm &lt;span class="nt"&gt;-r&lt;/span&gt; | &lt;span class="nb"&gt;head&lt;/span&gt; &lt;span class="nt"&gt;-4&lt;/span&gt;
&lt;span class="go"&gt; %CPU   PID  COMM
129.6  8320  /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
 43.2 58249  .../Google Chrome Helper (Renderer)
 27.5 69725  .../UsageTrackingAgent
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The load average still read 74 at that point, which is expected. It is a decaying rolling average and lags reality by design. The 1-minute figure had already dropped from 122 to 74 and kept falling; the 15-minute figure was still carrying the previous quarter-hour of saturation. Judge the fix by the process list, not the load average. The fan takes another minute or two beyond the CPU drop while the heat already in the chassis dissipates.&lt;/p&gt;

&lt;h2&gt;
  
  
  Checking your own machine
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;uptime&lt;/span&gt;                              &lt;span class="c"&gt;# load average well above your core count?&lt;/span&gt;
sysctl &lt;span class="nt"&gt;-n&lt;/span&gt; hw.ncpu                   &lt;span class="c"&gt;# what your core count actually is&lt;/span&gt;
ps &lt;span class="nt"&gt;-Ao&lt;/span&gt; pcpu,pid,ppid,user,comm &lt;span class="nt"&gt;-r&lt;/span&gt; | &lt;span class="nb"&gt;head&lt;/span&gt; &lt;span class="nt"&gt;-15&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Look for processes eating CPU with &lt;code&gt;PPID 1&lt;/code&gt; and a long &lt;code&gt;etime&lt;/code&gt;. Reparenting to &lt;code&gt;launchd&lt;/code&gt; plus an elapsed time measured in days means nobody is supervising it and nobody is going to clean it up. Shells and interpreters are worth a closer look, since &lt;code&gt;comm&lt;/code&gt; shows you &lt;code&gt;/bin/zsh&lt;/code&gt; or &lt;code&gt;node&lt;/code&gt; and tells you nothing about what is inside. Get the arguments:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ps &lt;span class="nt"&gt;-o&lt;/span&gt; pid,ppid,lstart,etime,pcpu,args &lt;span class="nt"&gt;-p&lt;/span&gt; &amp;lt;pid&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On macOS, Activity Monitor sorted by CPU shows the same thing, but the process name column has the same problem: ten identical &lt;code&gt;zsh&lt;/code&gt; rows and no hint of what they are running.&lt;/p&gt;

&lt;h2&gt;
  
  
  Takeaway
&lt;/h2&gt;

&lt;p&gt;Agents run real commands, including ones that deliberately consume resources, and a crashed or cancelled session does not necessarily take its children with it. If you let an agent spawn background work, it is worth knowing how to spot the leftovers. &lt;code&gt;ps -Ao pcpu,pid,ppid,user,comm -r | head&lt;/code&gt; costs nothing and would have caught this two days earlier.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>claude</category>
      <category>agents</category>
    </item>
    <item>
      <title>Node.js logger for Discord</title>
      <dc:creator>Sidhant Panda</dc:creator>
      <pubDate>Tue, 09 Jun 2020 18:07:32 +0000</pubDate>
      <link>https://dev.to/sidhantpanda/node-js-logger-for-discord-51j8</link>
      <guid>https://dev.to/sidhantpanda/node-js-logger-for-discord-51j8</guid>
      <description>&lt;p&gt;I wrote a small library to send Node.js application logs to Discord in a structured format.&lt;/p&gt;

&lt;p&gt;Github Project - &lt;a href="https://github.com/sidhantpanda/node-discord-logger" rel="noopener noreferrer"&gt;https://github.com/sidhantpanda/node-discord-logger&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Features:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;6 levels of logging&lt;/li&gt;
&lt;li&gt;Send complete error stack to Discord&lt;/li&gt;
&lt;li&gt;Send JSON objects which will be pretty-printed in Discord&lt;/li&gt;
&lt;li&gt;Configure meta data such as machine hostname, process id to be sent with every request&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Some example messages.
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Error Message&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fsidhantpanda%2Fpublic%2Fmaster%2Fimg%2Fprojects%2Fnode-discord-logger%2Ferror-message.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fsidhantpanda%2Fpublic%2Fmaster%2Fimg%2Fprojects%2Fnode-discord-logger%2Ferror-message.png" alt="error message example"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Warning Message&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fsidhantpanda%2Fpublic%2Fmaster%2Fimg%2Fprojects%2Fnode-discord-logger%2Fwarning-message.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fsidhantpanda%2Fpublic%2Fmaster%2Fimg%2Fprojects%2Fnode-discord-logger%2Fwarning-message.png" alt="warning message example"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Debug Message&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fsidhantpanda%2Fpublic%2Fmaster%2Fimg%2Fprojects%2Fnode-discord-logger%2Fdebug-message.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fsidhantpanda%2Fpublic%2Fmaster%2Fimg%2Fprojects%2Fnode-discord-logger%2Fdebug-message.png" alt="debug message example"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a&gt;&lt;/a&gt;Info Message&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fsidhantpanda%2Fpublic%2Fmaster%2Fimg%2Fprojects%2Fnode-discord-logger%2Finfo-message.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fsidhantpanda%2Fpublic%2Fmaster%2Fimg%2Fprojects%2Fnode-discord-logger%2Finfo-message.png" alt="info message example"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Verbose Message&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fsidhantpanda%2Fpublic%2Fmaster%2Fimg%2Fprojects%2Fnode-discord-logger%2Fverbose-message.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fsidhantpanda%2Fpublic%2Fmaster%2Fimg%2Fprojects%2Fnode-discord-logger%2Fverbose-message.png" alt="verbose message example"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Silly Message&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fsidhantpanda%2Fpublic%2Fmaster%2Fimg%2Fprojects%2Fnode-discord-logger%2Fsilly-message.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fsidhantpanda%2Fpublic%2Fmaster%2Fimg%2Fprojects%2Fnode-discord-logger%2Fsilly-message.png" alt="silly message example"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>showdev</category>
    </item>
    <item>
      <title>A Dockerized Nodejs Express Boilerplate with TypeScript</title>
      <dc:creator>Sidhant Panda</dc:creator>
      <pubDate>Thu, 26 Sep 2019 19:49:49 +0000</pubDate>
      <link>https://dev.to/sidhantpanda/a-dockerized-nodejs-express-boilerplate-with-typescript-2bb2</link>
      <guid>https://dev.to/sidhantpanda/a-dockerized-nodejs-express-boilerplate-with-typescript-2bb2</guid>
      <description>&lt;p&gt;Github Project: &lt;a href="https://github.com/sidhantpanda/docker-express-typescript-boilerplate"&gt;https://github.com/sidhantpanda/docker-express-typescript-boilerplate&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Getting started with TypeScript for your next backend project? Or just want to play around with a TypeScript based Express server? This project’s for you!&lt;/p&gt;

&lt;h1&gt;
  
  
  Microsoft already has a starter repo. Why this?
&lt;/h1&gt;

&lt;p&gt;There is Microsoft’s  &lt;a href="https://github.com/microsoft/TypeScript-Node-Starter"&gt;starter repo&lt;/a&gt;  but it requires you to install a bunch of other stuff like MongoDB yourself. The Microsoft repo is a good reference repository but lacks a lot of stuff when building production applications.&lt;/p&gt;

&lt;h1&gt;
  
  
  How to get started?
&lt;/h1&gt;

&lt;p&gt;Simple, just run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ bash &amp;lt;(curl -s https://raw.githubusercontent.com/sidhantpanda/public/master/scripts/generate-express-ts-app.sh)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Or, if you don’t trust the shell script, clone the repo:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git clone git@github.com:sidhantpanda/docker-express-typescript-boilerplate.git your-app-name
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h1&gt;
  
  
  Features
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;You can spin up &lt;strong&gt;Mongo&lt;/strong&gt; containers and run your Node project with nodemon with a &lt;strong&gt;single command&lt;/strong&gt;, and spin them down when you are done. Just run the following command and see it happening:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ npm run dev
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Running the above commands results in&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🌏API Server running at &lt;code&gt;http://localhost:3000&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;⚙️Swagger UI at &lt;code&gt;http://localhost:3000/dev/api-docs&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;🛢️MongoDB running at &lt;code&gt;mongodb://localhost:27017&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Pressing &lt;code&gt;Ctrl + c&lt;/code&gt; will stop the server and remove all mongo containers. All the data in Mongo is &lt;strong&gt;persisted&lt;/strong&gt; between the runs at data/dev/mongo .&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;This project also contains instructions to &lt;strong&gt;dockerize&lt;/strong&gt; your application from the get go, so you get to learn Docker along with it, or experienced developers can directly start configuring the Dockerfile or docker-compose.yml files.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A &lt;strong&gt;&lt;a href="https://github.com/sidhantpanda/docker-express-typescript-boilerplate/blob/master/src/middleware/handle-error-middleware.ts"&gt;custom middleware&lt;/a&gt;&lt;/strong&gt; for easier async/await for your request handlers. This allows you to write less verbose and eliminate having to write try-catch blocks in your request handlers every time you want to write an async method. Just throw any error and the handler will catch it and pass it on to the Express error handler.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/sidhantpanda/docker-express-typescript-boilerplate/blob/master/src/models/Book.ts"&gt;Sample mongoose model&lt;/a&gt;&lt;/strong&gt; written in TypeScript. Lets you kick-start data modelling.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Comes with a  &lt;a href="https://github.com/sidhantpanda/docker-express-typescript-boilerplate/blob/master/openapi.json"&gt;sample Open API 3.0 spec file&lt;/a&gt;  so you can get started with API documentation directly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;All configuration done through &lt;code&gt;.env&lt;/code&gt; file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;ESLint + Prettier&lt;/strong&gt; — Linting and formatting from the start&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Winston&lt;/strong&gt; as the default logger to generate debug and error log files during application lifetime.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Pre-configured &lt;strong&gt;Travis CI&lt;/strong&gt; for that automation goodness.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>docker</category>
      <category>typescript</category>
      <category>showdev</category>
      <category>node</category>
    </item>
    <item>
      <title>A Colorful Logger for the Browser</title>
      <dc:creator>Sidhant Panda</dc:creator>
      <pubDate>Tue, 24 Sep 2019 15:23:00 +0000</pubDate>
      <link>https://dev.to/sidhantpanda/a-colorful-logger-for-the-browser-1id8</link>
      <guid>https://dev.to/sidhantpanda/a-colorful-logger-for-the-browser-1id8</guid>
      <description>&lt;p&gt;Introducing a colorful logger built for easing front-end development — &lt;a href="https://www.npmjs.com/package/logt" rel="noopener noreferrer"&gt;logt&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;
  &lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FefMwTMd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FefMwTMd.png"&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Features
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Small library size&lt;/strong&gt; - Only ~1.3KB gzipped!&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Colorful labels&lt;/strong&gt; to help distinguish logs by importance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Log levels&lt;/strong&gt; to hide less important log messages.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Show hidden messages programmatically&lt;/strong&gt; to print logs hidden due log level.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Built with TypeScript&lt;/strong&gt; for detailed type info and that sweet sweet autocomplete.
&lt;p&gt;
&lt;a href="https://i.giphy.com/media/ckNv6K3sRo8dWOUtH7/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/ckNv6K3sRo8dWOUtH7/giphy.gif"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ npm i logt -S
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Usage
&lt;/h2&gt;

&lt;p&gt;You can use this logger for your frontend projects. You can choose as an ES6 module or directly include the script in HTML.&lt;/p&gt;

&lt;h4&gt;
  
  
  As an ES6 module
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;LogT&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;logt&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;LOG_TAG&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;sample tag&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;logger&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;LogT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;error&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;LOG_TAG&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;example error&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Include in HTML
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;script&lt;/span&gt; &lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://cdn.jsdelivr.net/gh/sidhantpanda/logt/dist/logt.min.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/script&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;script&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;LOG_TAG&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sample tag&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;logger&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createLogger&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;error&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;LOG_TAG&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;example error&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/script&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Peek into hidden logs
&lt;/h2&gt;

&lt;p&gt;This feature allows to quickly see hidden logs in the developer tools without having to make code changes. The logger stores all hidden messages locally.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;logger&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;LogT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Only error logs will printed to console&lt;/span&gt;
&lt;span class="nx"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;warn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;TAG&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;warning message&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Will not print anything to console&lt;/span&gt;
&lt;span class="nx"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;TAG&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;info message&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Will not print anything to console&lt;/span&gt;
&lt;span class="nx"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;debug&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;TAG&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;debug message&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Will not print anything to console&lt;/span&gt;
&lt;span class="nx"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;silly&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;TAG&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;silly message&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Will not print anything to console&lt;/span&gt;

&lt;span class="nx"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;showHidden&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Will print the warning message&lt;/span&gt;
&lt;span class="nx"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;showHidden&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Will print the info warning message&lt;/span&gt;
&lt;span class="nx"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;showHidden&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Will print the debug as well as silly message&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check out the project on &lt;a href="https://github.com/sidhantpanda/logt" rel="noopener noreferrer"&gt;Github&lt;/a&gt; for more details documentation!&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>javascript</category>
      <category>frontend</category>
      <category>webdev</category>
    </item>
    <item>
      <title>A Discord transport for Winston Logger</title>
      <dc:creator>Sidhant Panda</dc:creator>
      <pubDate>Wed, 18 Sep 2019 14:24:05 +0000</pubDate>
      <link>https://dev.to/sidhantpanda/a-discord-transport-for-winston-logger-370f</link>
      <guid>https://dev.to/sidhantpanda/a-discord-transport-for-winston-logger-370f</guid>
      <description>&lt;p&gt;I just published an npm package to send log messages directly to your Discord channel.&lt;/p&gt;

&lt;p&gt;Check out &lt;a href="https://github.com/sidhantpanda/winston-discord-transport"&gt;winston-discord-transport&lt;/a&gt; on Github!&lt;/p&gt;

&lt;p&gt;It's pretty straight-forward to use if your already use winston to manage server logs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Install the package
&lt;/h3&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ npm i winston-discord-transport
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Use the transport
&lt;/h3&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;winston&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;winston&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;DiscordTransport&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;winston-discord-transport&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;logger&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;winston&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;createLogger&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;transports&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;DiscordTransport&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
      &lt;span class="na"&gt;webhook&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https:/your/discord/webhook&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;defaultMeta&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;service&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;my_node_service&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="na"&gt;level&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;warn&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;level&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;error&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Error intializing service&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;If you provide an &lt;code&gt;error&lt;/code&gt; in the log message, the transport will send the entire error stack to Discord, so you can pin point the location of error directly from the message.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yXnBPUOX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/nsQR12X/Screenshot-2019-09-18-at-7-04-59-PM.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yXnBPUOX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/nsQR12X/Screenshot-2019-09-18-at-7-04-59-PM.png" alt="Error message screenshot"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Check out the &lt;a href="https://github.com/sidhantpanda/winston-discord-transport"&gt;README&lt;/a&gt; for more information!&lt;/p&gt;

</description>
      <category>node</category>
      <category>typescript</category>
      <category>npm</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Self Hosted Gitlab Continuous Deployment to Netlify</title>
      <dc:creator>Sidhant Panda</dc:creator>
      <pubDate>Mon, 26 Aug 2019 20:23:45 +0000</pubDate>
      <link>https://dev.to/sidhantpanda/self-hosted-gitlab-continuous-deployment-to-netlify-49lk</link>
      <guid>https://dev.to/sidhantpanda/self-hosted-gitlab-continuous-deployment-to-netlify-49lk</guid>
      <description>&lt;p&gt;If you haven't yet checkout out &lt;a href="https://netlify.com" rel="noopener noreferrer"&gt;Netlify&lt;/a&gt;, you definitely should!&lt;/p&gt;

&lt;p&gt;While Netlify has direct integration with Github, Bitbucket and the managed Gitlab service, things get confusing if you have your own Gitlab instance. This post is to help out anyone wanting to write a Gitlab pipeline to deploy their website directly to Netlify from Gitlab's CI/CD tool.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Get your Netlify Personal Access
&lt;/h3&gt;

&lt;p&gt;Head over to &lt;a href="https://app.netlify.com/user/applications#personal-access-tokens" rel="noopener noreferrer"&gt;User Settings &amp;gt; Applications &amp;gt; Personal Access Token&lt;/a&gt; and generate a new access token. You put "Gitlab CD" as the description of your token. Once generated, make sure you copy and keep the access token in a file or in an active editor window.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Get your Netlify Site API ID
&lt;/h3&gt;

&lt;p&gt;Next, go to your site's setting page in Netlify Dashboard can copy the value of &lt;code&gt;API ID&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Add the variables to your Gitlab CI/CD settings
&lt;/h3&gt;

&lt;p&gt;Open the repo on your self-hosted Gitlab instance and go to Settings &amp;gt; CI/CD. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add the access token from step 1 under the variable name &lt;code&gt;NETLIFY_AUTH_TOKEN&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Add the API ID from step 2 under the variable name &lt;code&gt;NETLIFY_SITE_ID&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.ibb.co%2FWBL0zsb%2FScreenshot-2019-08-27-at-1-39-36-AM.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.ibb.co%2FWBL0zsb%2FScreenshot-2019-08-27-at-1-39-36-AM.png" alt="Screenshot-2019-08-27-at-1-39-36-AM"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: Add a &lt;code&gt;.gitlab-ci.yml&lt;/code&gt; file to your repo
&lt;/h3&gt;

&lt;p&gt;Add the Gitlab CI file to your repo. Following is a basic template to start you off:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;stages&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;deploy&lt;/span&gt;

&lt;span class="na"&gt;deploy&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;stage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;deploy&lt;/span&gt;
  &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;production&lt;/span&gt;
    &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;https://your.website.com&lt;/span&gt;
  &lt;span class="na"&gt;only&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;master&lt;/span&gt;
  &lt;span class="na"&gt;script&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;npm i&lt;/span&gt;
    &lt;span class="c1"&gt;# your build command&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;npm run build&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;npx netlify-cli deploy --site $NETLIFY_SITE_ID --auth $NETLIFY_AUTH_TOKEN --prod&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 5: Add a file named &lt;code&gt;netlify.toml&lt;/code&gt; to your repo
&lt;/h3&gt;

&lt;p&gt;This file contains the directory which needs to be pushed to Netlify (the directory where your project is built). It's usually named &lt;code&gt;build&lt;/code&gt; or &lt;code&gt;dist&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight toml"&gt;&lt;code&gt;&lt;span class="nn"&gt;[build]&lt;/span&gt;
  &lt;span class="py"&gt;publish&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"build"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it! Now just commit these changes and push to &lt;code&gt;master&lt;/code&gt; and see your website get deployed on Netlify :)&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>devops</category>
      <category>git</category>
      <category>react</category>
    </item>
  </channel>
</rss>
