<?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>Forem: Suharxxxx</title>
    <description>The latest articles on Forem by Suharxxxx (@suharyadi2112).</description>
    <link>https://forem.com/suharyadi2112</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F991858%2Fdfbddf87-4530-4696-adf3-43769113ccae.jpeg</url>
      <title>Forem: Suharxxxx</title>
      <link>https://forem.com/suharyadi2112</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/suharyadi2112"/>
    <language>en</language>
    <item>
      <title>Building a WhatsApp Multi-Instance REST API with Go, Echo, and Whatsmeow 🚀</title>
      <dc:creator>Suharxxxx</dc:creator>
      <pubDate>Sun, 07 Dec 2025 17:15:15 +0000</pubDate>
      <link>https://forem.com/suharyadi2112/building-a-whatsapp-multi-instance-rest-api-with-go-echo-and-whatsmeow-5bln</link>
      <guid>https://forem.com/suharyadi2112/building-a-whatsapp-multi-instance-rest-api-with-go-echo-and-whatsmeow-5bln</guid>
      <description>&lt;p&gt;Introduction&lt;br&gt;
Ever needed to manage multiple WhatsApp accounts programmatically? Whether you're building a customer service platform, notification system, or automation tool, handling multiple WhatsApp instances can be challenging.&lt;/p&gt;

&lt;p&gt;In this article, I'll share my journey building SUDEVWA - a production-ready WhatsApp Multi-Instance REST API using Go, Echo framework, and the powerful Whatsmeow library.&lt;/p&gt;

&lt;p&gt;🎯 What We're Building&lt;br&gt;
A REST API that can:&lt;/p&gt;

&lt;p&gt;✅ Manage multiple WhatsApp accounts simultaneously&lt;br&gt;
✅ Send/receive messages in real-time via WebSocket&lt;br&gt;
✅ Handle media files (images, videos, documents)&lt;br&gt;
✅ Maintain persistent sessions across server restarts&lt;br&gt;
✅ Auto-reconnect disconnected instances&lt;/p&gt;

&lt;p&gt;🛠️ Tech Stack&lt;br&gt;
Go 1.21+ - Performance and concurrency&lt;br&gt;
Echo v4 - Fast HTTP router&lt;br&gt;
Whatsmeow - WhatsApp Web multidevice API&lt;br&gt;
PostgreSQL - Session persistence&lt;br&gt;
Gorilla WebSocket - Real-time communication&lt;/p&gt;

&lt;p&gt;┌─────────────┐&lt;br&gt;
│   Client    │&lt;br&gt;
└──────┬──────┘&lt;br&gt;
       │ HTTP/WebSocket&lt;br&gt;
┌──────▼──────┐&lt;br&gt;
│  Echo API   │&lt;br&gt;
├─────────────┤&lt;br&gt;
│  Service    │ ← Multi-instance manager&lt;br&gt;
│   Layer     │&lt;br&gt;
├─────────────┤&lt;br&gt;
│ Whatsmeow   │ ← WhatsApp protocol&lt;br&gt;
└──────┬──────┘&lt;br&gt;
       │&lt;br&gt;
┌──────▼──────┐&lt;br&gt;
│ PostgreSQL  │ ← Session storage&lt;br&gt;
└─────────────┘&lt;/p&gt;

&lt;p&gt;🚀 Key Features Implementation&lt;/p&gt;
&lt;h2&gt;
  
  
  Multi-Instance Management
&lt;/h2&gt;

&lt;p&gt;Each WhatsApp account is isolated as an "instance" with its own:&lt;br&gt;
Database connection&lt;br&gt;
Whatsmeow client&lt;br&gt;
Event handlers&lt;br&gt;
Session data&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type Session struct {
    InstanceID  string
    Client      *whatsmeow.Client
    IsConnected bool
    JID         string
}

var sessions = make(map[string]*Session)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Real-time Message Listener via WebSocket
&lt;/h2&gt;

&lt;p&gt;Two WebSocket endpoints for different use cases:&lt;/p&gt;

&lt;p&gt;Global WebSocket (/ws) - System events:&lt;/p&gt;

&lt;p&gt;QR code generation&lt;br&gt;
Login/logout events&lt;br&gt;
Connection status changes&lt;br&gt;
Instance-specific WebSocket (/api/listen/:instanceId) - Message inbox:&lt;br&gt;
Incoming messages for specific instance&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Broadcast incoming messages to WebSocket clients
case *events.Message:
    Realtime.BroadcastToInstance(instanceID, map[string]interface{}{
        "event":       "incoming_message",
        "instance_id": instanceID,
        "from":        v.Info.Sender.String(),
        "message":     messageText,
        "timestamp":   v.Info.Timestamp.Unix(),
        "is_group":    v.Info.IsGroup,
    })

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Persistent Sessions with Auto-Reconnect
&lt;/h2&gt;

&lt;p&gt;Sessions survive server restarts by storing device data in PostgreSQL:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;func LoadAllDevices() error {
    devices, err := model.GetAllConnectedInstances()
    for _, device := range devices {
        // Recreate whatsmeow client
        client := whatsmeow.NewClient(device.Store, waLog.Stdout("Client", "INFO", true))
        client.AddEventHandler(eventHandler(device.InstanceID))

        // Reconnect
        if err := client.Connect(); err != nil {
            log.Printf("Failed to reconnect %s: %v", device.InstanceID, err)
        }
    }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Ping-based WebSocket Keep-Alive
&lt;/h2&gt;

&lt;p&gt;Prevent connection timeouts with automatic ping/pong:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;func (c *Client) WritePump() {
    ticker := time.NewTicker(5 * time.Minute)
    defer ticker.Stop()

    for {
        select {
        case event := &amp;lt;-c.send:
            // Send message

        case &amp;lt;-ticker.C:
            // Send ping every 5 minutes
            if err := c.conn.WriteMessage(websocket.PingMessage, nil); err != nil {
                return
            }
        }
    }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Flexible Message Sending
&lt;/h2&gt;

&lt;p&gt;Send messages by instance ID or phone number:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// By instance ID
POST /api/send/:instanceId
{
    "to": "628123456789",
    "message": "Hello!"
}

// By phone number (finds instance automatically)
POST /api/by-number/:phoneNumber
{
    "to": "628987654321",
    "message": "Hi there!"
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;📊 WebSocket Real-time Events&lt;br&gt;
Example incoming message event:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "event": "incoming_message",
  "timestamp": "2025-12-08T00:00:00Z",
  "data": {
    "instance_id": "instance123",
    "from": "6281234567890@s.whatsapp.net",
    "from_me": false,
    "message": "Hello World",
    "timestamp": 1733587980,
    "is_group": false,
    "message_id": "3EB0ABC123DEF456",
    "push_name": "John Doe"
  }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;🔐 Security &amp;amp; Best Practices&lt;/p&gt;

&lt;p&gt;JWT Authentication - Protect all API endpoints&lt;br&gt;
Rate Limiting - 10 requests/second per IP&lt;br&gt;
CORS Configuration - Whitelist allowed origins&lt;br&gt;
Number Validation - Verify WhatsApp registration before sending&lt;br&gt;
Graceful Shutdown - Proper cleanup on logout&lt;/p&gt;

&lt;p&gt;🎯 Use Cases&lt;/p&gt;

&lt;p&gt;Customer Service - Multi-agent support with different WhatsApp numbers&lt;br&gt;
Notifications - Send alerts from multiple business accounts&lt;br&gt;
Chatbots - Build conversational AI with WhatsApp&lt;br&gt;
Automation - Scheduled messages, bulk sending&lt;br&gt;
Monitoring - Real-time message tracking dashboard&lt;/p&gt;

&lt;p&gt;📈 Performance Considerations&lt;/p&gt;

&lt;p&gt;Goroutines for concurrent instance management&lt;br&gt;
Channel-based event broadcasting&lt;br&gt;
Connection pooling for PostgreSQL&lt;br&gt;
Memory-efficient session storage&lt;br&gt;
Auto-cleanup of ghost WebSocket connections (15min timeout)&lt;/p&gt;

&lt;p&gt;🚧 Challenges &amp;amp; Solutions&lt;br&gt;
Challenge 1: Session Persistence&lt;br&gt;
Problem: Sessions lost on server restart&lt;br&gt;
Solution: Store Whatsmeow device data in PostgreSQL, reload on startup&lt;/p&gt;

&lt;p&gt;Challenge 2: Memory Leaks from Dead Connections&lt;br&gt;
Problem: WebSocket connections not properly closed&lt;br&gt;
Solution: Ping/pong mechanism with 15-minute timeout&lt;/p&gt;

&lt;p&gt;Challenge 3: Race Conditions with Multiple Instances&lt;br&gt;
Problem: Concurrent map access&lt;br&gt;
Solution: sync.RWMutex for thread-safe operations&lt;/p&gt;

&lt;p&gt;🔮 What's Next?&lt;br&gt;
📋 Webhook support for incoming messages&lt;br&gt;
👥 Group management (create, add members, etc.)&lt;br&gt;
📱 Status/story posting&lt;br&gt;
📊 Analytics dashboard&lt;br&gt;
🔄 Message templates for bulk sending&lt;br&gt;
📦 Try It Yourself&lt;/p&gt;

&lt;p&gt;The project is open-source and available on GitHub:&lt;/p&gt;

&lt;p&gt;

&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/suharyadi2112" rel="noopener noreferrer"&gt;
        suharyadi2112
      &lt;/a&gt; / &lt;a href="https://github.com/suharyadi2112/Sudev-WhatsApp-API" rel="noopener noreferrer"&gt;
        Sudev-WhatsApp-API
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      WhatsApp Multi-Instance Manager  A robust WhatsApp automation tool built with Go and Whatsmeow, designed for managing multiple WhatsApp instances with real-time monitoring and message handling capabilities.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;SUDEVWA - WhatsApp Multi-Instance API (Go/Golang)&lt;/h1&gt;
&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;WhatsApp Automation API&lt;/strong&gt; | &lt;strong&gt;Multi-Device Management&lt;/strong&gt; | &lt;strong&gt;Real-time WebSocket&lt;/strong&gt; | &lt;strong&gt;Go + Echo + Whatsmeow&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;REST API for &lt;strong&gt;WhatsApp Web automation&lt;/strong&gt;, &lt;strong&gt;multi-instance management&lt;/strong&gt;, and &lt;strong&gt;real-time messaging&lt;/strong&gt; built with &lt;strong&gt;Go (Golang)&lt;/strong&gt;, &lt;strong&gt;Echo framework&lt;/strong&gt;, and &lt;strong&gt;whatsmeow library&lt;/strong&gt;.&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;🔍 Keywords&lt;/h2&gt;
&lt;/div&gt;

&lt;p&gt;WhatsApp API, WhatsApp Bot, Multi-instance WhatsApp, WhatsApp Automation, Go WhatsApp, Whatsmeow, WebSocket Real-time, REST API, PostgreSQL, Echo Framework&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;✨ Key Features&lt;/h2&gt;
&lt;/div&gt;

&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;🔐 Authentication &amp;amp; Instance Management&lt;/h3&gt;

&lt;/div&gt;


&lt;ul&gt;

&lt;li&gt;Multi-instance — manage multiple WhatsApp numbers simultaneously&lt;/li&gt;

&lt;li&gt;QR Code authentication — generate QR for device pairing&lt;/li&gt;

&lt;li&gt;Persistent sessions — sessions survive restart, stored in PostgreSQL&lt;/li&gt;

&lt;li&gt;Auto-reconnect — instances automatically reconnect after server restart&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Instance reusability&lt;/strong&gt; — logged out instances can scan QR again without creating new instance&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Instance availability control&lt;/strong&gt; — &lt;code&gt;used&lt;/code&gt; flag for external app integration, &lt;code&gt;keterangan&lt;/code&gt; for notes/tracking&lt;/li&gt;

&lt;li&gt;Graceful logout — complete cleanup (device store + session memory)&lt;/li&gt;

&lt;li&gt;Circle/group management — organize instances by…&lt;/li&gt;

&lt;/ul&gt;
&lt;/div&gt;
&lt;br&gt;
  &lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/suharyadi2112/Sudev-WhatsApp-API" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Clone repository
git clone https://github.com/suharyadi2112/Sudev-Whatsapp-Tools.git
cd Sudev-Whatsapp-Tools

# Setup environment
cp .env.example .env
# Edit .env with your PostgreSQL credentials

# Run migrations
go run main.go --createschema

# Start server
go run main.go

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Visit &lt;a href="http://localhost:2121" rel="noopener noreferrer"&gt;http://localhost:2121&lt;/a&gt; and you're ready! 🎉&lt;/p&gt;

&lt;p&gt;💡 Key Takeaways&lt;br&gt;
Whatsmeow makes WhatsApp automation accessible in Go&lt;/p&gt;

&lt;p&gt;WebSocket perfect for real-time messaging features&lt;/p&gt;

&lt;p&gt;PostgreSQL essential for session persistence&lt;/p&gt;

&lt;p&gt;Multi-instance architecture enables scalability&lt;/p&gt;

&lt;p&gt;Event-driven design keeps code maintainable&lt;/p&gt;

&lt;p&gt;🤝 Contribute&lt;br&gt;
Found this useful? Consider:&lt;/p&gt;

&lt;p&gt;⭐ Star the repository&lt;br&gt;
🐛 Report issues&lt;br&gt;
🔧 Submit pull requests&lt;br&gt;
💬 Share feedback&lt;br&gt;
📚 Resources&lt;/p&gt;

&lt;h2&gt;
  
  
  Whatsmeow Documentation
&lt;/h2&gt;

&lt;p&gt;Echo Framework Guide&lt;br&gt;
Gorilla WebSocket&lt;/p&gt;

&lt;p&gt;What's your experience with WhatsApp automation? Have questions about the implementation? Drop a comment below! 👇&lt;/p&gt;

&lt;h1&gt;
  
  
  golang #go #whatsapp #api #websocket #opensource #tutorial
&lt;/h1&gt;

</description>
    </item>
    <item>
      <title>Web Application Debugging with Sentry Session Replay: Comprehensive Walkthrough 🚀🚀</title>
      <dc:creator>Suharxxxx</dc:creator>
      <pubDate>Sat, 26 Aug 2023 06:50:00 +0000</pubDate>
      <link>https://forem.com/suharyadi2112/web-application-debugging-with-sentry-session-replay-comprehensive-walkthrough-286h</link>
      <guid>https://forem.com/suharyadi2112/web-application-debugging-with-sentry-session-replay-comprehensive-walkthrough-286h</guid>
      <description>&lt;h2&gt;
  
  
  What Is ?? 🧐🤔
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Sentry Session Replay&lt;/strong&gt; is a feature that allows recording every user action within our application. In this article, we will explain in simple terms how Session Replay Sentry can replay user actions to help us understand and troubleshoot issues &lt;a href="https://docs.sentry.io/platforms/javascript/session-replay/" rel="noopener noreferrer"&gt;Session Replay&lt;/a&gt; &lt;a href="https://sentry.io/welcome/" rel="noopener noreferrer"&gt;Sentry&lt;/a&gt;. Let's learn how Session Replay Sentry can enhance the quality of our application! ⚡&lt;br&gt;
&lt;a href="https://i.giphy.com/media/YByNQrx0V4Gzv9CBSk/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/YByNQrx0V4Gzv9CBSk/giphy.gif"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have discussed the steps for installing Sentry to manage &lt;strong&gt;error logs&lt;/strong&gt; &lt;a href="https://dev.to/suharyadi2112/test-1k25"&gt;Configuration Sentry Golang&lt;/a&gt;, which include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Creating a Sentry account.&lt;/li&gt;
&lt;li&gt;Connecting the application to Sentry using an API key (Golang).&lt;/li&gt;
&lt;li&gt;Integrating the Sentry SDK into the application code to track and record error logs (Golang).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However, at this point, we will delve into an additional feature of Sentry known as &lt;strong&gt;Sentry Session Replay&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The main purpose of 😲🤔
&lt;/h2&gt;

&lt;p&gt;Using &lt;strong&gt;Sentry Session Replay&lt;/strong&gt; is to record and replay your sessions within the application. With this feature, you can accurately review what happened in your experience before the occurrence of an error or problematic situation. This helps you and the development team identify the causes of errors more quickly, understand your interactions with the interface, and make necessary improvements to enhance your overall experience. &lt;a href="https://www.youtube.com/watch?v=Zrq4kcNfAGw" rel="noopener noreferrer"&gt;Session Replay Overview: Watch User Sessions to Confirm Issues and Debug Faster&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Lets Start 🚦🚗
&lt;/h2&gt;

&lt;p&gt;Make sure you've got the tools. The installation is a breeze, no worries. Unlike the official Sentry Setup &lt;strong&gt;Session Replay docs&lt;/strong&gt; &lt;a href="https://docs.sentry.io/platforms/javascript/session-replay/#install" rel="noopener noreferrer"&gt;Pre-requisites(Install)&lt;/a&gt;, which use NPM packages, we're taking a scenic route using CDN bundles &lt;a href="https://docs.sentry.io/platforms/javascript/install/loader/#performance--replay-bundle" rel="noopener noreferrer"&gt;Performance &amp;amp; Replay Bundle&lt;/a&gt; or &lt;a href="https://docs.sentry.io/platforms/javascript/install/loader/#errors--replay-bundle" rel="noopener noreferrer"&gt;Errors &amp;amp; Replay Bundle&lt;/a&gt;. Just add the Sentry loader script to your web page and you're set!&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foql3gxsrilcwnln8xr0a.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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foql3gxsrilcwnln8xr0a.png" alt="Errors &amp;amp; Replay Bundle"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Place the &lt;strong&gt;CDN loader script&lt;/strong&gt; for &lt;strong&gt;Errors &amp;amp; Replay Bundle&lt;/strong&gt; above your page (marked with a red box).&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F17qfuq2h3y3j5tqbtpi1.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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F17qfuq2h3y3j5tqbtpi1.png" alt="Screenshot Code Script Loader and Instance Sentry"&gt;&lt;/a&gt;&lt;/p&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://browser.sentry-cdn.com/7.64.0/bundle.replay.min.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
  &lt;span class="nx"&gt;integrity&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;sha384-eIBhmVs6phxABM7+IIv3ns4W+ShqowNbNrv8gOqCw8sqxfvNjsA5M9c64D5Oobcv&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
  &lt;span class="nx"&gt;crossorigin&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;anonymous&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;const&lt;/span&gt; &lt;span class="nx"&gt;replay&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;Sentry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Replay&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;maskAllText&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;blockAllMedia&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="nx"&gt;Sentry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;init&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
        &lt;span class="na"&gt;dsn&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://25a443e0b56147dd9f7552aa5ac7b14a@o450xxxxxxxxxxxx.ingest.sentry.io/4504378428096512&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;replaysSessionSampleRate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;replaysOnErrorSampleRate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;integrations&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="nx"&gt;replay&lt;/span&gt;
        &lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="nx"&gt;replay&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;start&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&amp;gt;  &lt;/span&gt;&lt;span class="err"&gt; 
&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now, let's dissect this code a bit.🤯&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;replay&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;Sentry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Replay&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;maskAllText&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;blockAllMedia&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&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;This part makes a new &lt;code&gt;Replay&lt;/code&gt; class instance from &lt;strong&gt;Sentry.Replay()&lt;/strong&gt; library. Two options:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; &lt;strong&gt;maskAllText&lt;/strong&gt; is set to &lt;code&gt;false&lt;/code&gt; to keep &lt;u&gt;text visible&lt;/u&gt;.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;blockAllMedia&lt;/strong&gt; is set to &lt;code&gt;true&lt;/code&gt; to hide &lt;u&gt;images/videos&lt;/u&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

&lt;span class="nx"&gt;Sentry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;init&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
        &lt;span class="na"&gt;dsn&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://25a443e0b56147dd9f7552aa5ac7b14a@o450xxxxxxxxxxxx.ingest.sentry.io/4504378428096512&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;replaysSessionSampleRate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;replaysOnErrorSampleRate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;integrations&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="nx"&gt;replay&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;ul&gt;
&lt;li&gt;Set things in motion with &lt;code&gt;Sentry.init()&lt;/code&gt;, swapping out &lt;code&gt;dsn:"https://YOUR_DSN_HERE"&lt;/code&gt; with your unique &lt;strong&gt;DSN&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;if u no have &lt;strong&gt;DSN&lt;/strong&gt; Create a new project by clicking here &lt;a href="https://dev.to/suharyadi2112/test-1k25"&gt;Configuration Sentry Golang&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Slide the &lt;code&gt;replaysSessionSampleRate&lt;/code&gt; to 1.0, capturing all sessions for the record &lt;/li&gt;
&lt;li&gt;Adjust &lt;code&gt;replaysOnErrorSampleRate&lt;/code&gt; to 1.0 as well, ensuring all errors have their moment.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;for the complete details about &lt;code&gt;replaysSessionSampleRate&lt;/code&gt;, &lt;code&gt;replaysOnErrorSampleRate&lt;/code&gt; and other configurations, you can check out &lt;a href="https://docs.sentry.io/platforms/javascript/session-replay/configuration/#general-integration-configuration" rel="noopener noreferrer"&gt;General Integration Configuration&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Integrate our crafted replay object into Sentry with &lt;code&gt;[replay]&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;const replay = new Sentry.Replay()&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

&lt;span class="nx"&gt;replay&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;start&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;The code &lt;code&gt;replay.start();&lt;/code&gt; gets the replay going. It's like hitting &lt;strong&gt;play&lt;/strong&gt; to start the &lt;strong&gt;replay&lt;/strong&gt; &lt;a href="https://docs.sentry.io/platforms/javascript/session-replay/understanding-sessions/#manually-starting-replay" rel="noopener noreferrer"&gt;Manually Starting Replay&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/aWNByu8u6sati/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/aWNByu8u6sati/giphy.gif"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We're going to do some testing. To intentionally cause an error, we need to input the function &lt;code&gt;myUndefinedFunction()&lt;/code&gt;. This code will trigger an error because the &lt;code&gt;myUndefinedFunction&lt;/code&gt; function hasn't been defined. The resulting error will be recorded in the &lt;strong&gt;Sentry Session Replay&lt;/strong&gt;."&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;myUndefinedFunction()&lt;/code&gt; function is documented in the Sentry documentation. You can find the details at this link &lt;a href="https://docs.sentry.io/platforms/javascript/session-replay/#set-up" rel="noopener noreferrer"&gt;Pre-requisites (Set Up)&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp35osuqksinwobh79iyt.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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp35osuqksinwobh79iyt.png" alt="Screenshot Function Error"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The important thing to remember is that the function &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;myUndefinedFunction();&lt;/code&gt; is purposely put right after &lt;code&gt;replay.start();&lt;/code&gt;. &lt;/li&gt;
&lt;li&gt;This is done to intentionally trigger an error caused by the undefined &lt;code&gt;myUndefinedFunction&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This careful arrangement is vital for effectively recording the error during &lt;strong&gt;Sentry Session Replay&lt;/strong&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcaegxjowssloznqyshq0.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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcaegxjowssloznqyshq0.png" alt="Screenshot Position myUndefinedFunction"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Give it a shot! 🚀🎇
&lt;/h2&gt;

&lt;p&gt;Putting our earlier code to the test. Let's see the results! &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;During this testing phase, I'm employing a basic application that I've personally crafted. This application will serve as the platform for capturing and recording session replays using Sentry&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Make sure the &lt;strong&gt;Loader Script&lt;/strong&gt; and the &lt;strong&gt;function call to Sentry&lt;/strong&gt; have been seamlessly integrated into your application. This provides a strong setup for running thorough tests.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We're about to begin testing, so make sure you've already created a project in Sentry. &lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;If you haven't&lt;/strong&gt;, you can check out the reference &lt;a href="https://docs.sentry.io/product/sentry-basics/integrate-frontend/create-new-project/#create-a-project" rel="noopener noreferrer"&gt;Create Project Sentry&lt;/a&gt; &lt;a href="https://dev.to/suharyadi2112/test-1k25"&gt;Configuration Sentry Golang&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Head to the Replay tab in the Sentry menu. It's essential for the next steps.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff6fu7zdbvyk7huwkwuyp.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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff6fu7zdbvyk7huwkwuyp.png" alt="Screenshot Dashboard Sentry session Replay"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;u&gt;After the author ran a series of tests&lt;/u&gt;, the dashboard will now look like this.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy7bgwinbet9m7tv145p6.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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy7bgwinbet9m7tv145p6.png" alt="Screenshot Dashboard Sentry session Replay"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Running ur Project Application, to run the app with the included Sentry &lt;strong&gt;Session Replay&lt;/strong&gt;, just start it. This turns on Sentry replay for testing. Remember, the added &lt;code&gt;myUndefinedFunction()&lt;/code&gt; intentionally creates an error that &lt;strong&gt;Sentry will record during replay&lt;/strong&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd4u4wkhlm9ywzr4ymbdj.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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd4u4wkhlm9ywzr4ymbdj.png" alt="Screenshot Aplication Running"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;To see the error causing &lt;code&gt;myUndefinedFunction()&lt;/code&gt; to be undefined, open the console in the &lt;strong&gt;Inspect Element&lt;/strong&gt; section. This is what will be recorded in the &lt;strong&gt;Sentry Session Replay&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;After encountering this error, return to the &lt;strong&gt;Sentry Session Replay&lt;/strong&gt; dashboard. Here, you'll be presented with a display resembling the following format, featuring various pieces of information, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;IP address&lt;/li&gt;
&lt;li&gt;Operating system in use&lt;/li&gt;
&lt;li&gt;Recording duration&lt;/li&gt;
&lt;li&gt;Number of errors&lt;/li&gt;
&lt;li&gt;And more.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz9o724an13ya5tr6mryu.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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz9o724an13ya5tr6mryu.png" alt="Screenshot dasboard sentry session replay"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Feel free to click on any of the &lt;strong&gt;IP addresses&lt;/strong&gt; to explore its comprehensive details. Within, you'll discover compelling data including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Video-like recording of user interactions.&lt;/li&gt;
&lt;li&gt;A chronological timeline of activities visually depicted as Breadcrumbs.&lt;/li&gt;
&lt;li&gt;Valuable insights pinpointing the occurrence of the &lt;code&gt;myUndefinedFunction()&lt;/code&gt; error. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Moreover, there are additional aspects that may necessitate specific configurations, potentially elaborated upon in forthcoming chapters.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvdulvgv0sd0y3z91py84.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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvdulvgv0sd0y3z91py84.png" alt="Screenshot detail session replay"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/xUPJPFex8frrbZFkKA/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/xUPJPFex8frrbZFkKA/giphy.gif"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  DONE 🏁✨
&lt;/h2&gt;

&lt;p&gt;In summary, this guide simplifies the process of setting up &lt;strong&gt;Sentry Session Replay&lt;/strong&gt;. Following these steps enables you to identify concealed problems like the &lt;code&gt;myUndefinedFunction()&lt;/code&gt; error effectively. The visualization of user interactions using videos and breadcrumbs adds significant strength to your debugging capabilities. As you dive further into Sentry session replay, you'll discover advanced configurations to elevate your error tracking proficiency. &lt;strong&gt;Thank you&lt;/strong&gt; for reading and be prepared to enhance your development skills further!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;br&gt;
Sentry JavaScript Session Replay Documentation. Sentry. &lt;a href="https://docs.sentry.io/platforms/javascript/session-replay/" rel="noopener noreferrer"&gt;https://docs.sentry.io/platforms/javascript/session-replay/&lt;/a&gt;&lt;br&gt;
Sentry JavaScript Session Replay Introduction. YouTube. &lt;a href="https://www.youtube.com/watch?v=Zrq4kcNfAGw" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=Zrq4kcNfAGw&lt;/a&gt;&lt;br&gt;
Installation Guide for Sentry Session Replay. Sentry. &lt;a href="https://docs.sentry.io/platforms/javascript/session-replay/#install" rel="noopener noreferrer"&gt;https://docs.sentry.io/platforms/javascript/session-replay/#install&lt;/a&gt;&lt;br&gt;
Enhance Performance with Replay Bundle. Sentry. &lt;a href="https://docs.sentry.io/platforms/javascript/install/loader/#performance--replay-bundle" rel="noopener noreferrer"&gt;https://docs.sentry.io/platforms/javascript/install/loader/#performance--replay-bundle&lt;/a&gt;&lt;br&gt;
Handle Errors Using Replay Bundle. Sentry. &lt;a href="https://docs.sentry.io/platforms/javascript/install/loader/#errors--replay-bundle" rel="noopener noreferrer"&gt;https://docs.sentry.io/platforms/javascript/install/loader/#errors--replay-bundle&lt;/a&gt;&lt;br&gt;
General Integration Configuration for Session Replay. Sentry. &lt;a href="https://docs.sentry.io/platforms/javascript/session-replay/configuration/#general-integration-configuration" rel="noopener noreferrer"&gt;https://docs.sentry.io/platforms/javascript/session-replay/configuration/#general-integration-configuration&lt;/a&gt;&lt;br&gt;
How to Set Up Sentry JavaScript Session Replay. Sentry. &lt;a href="https://docs.sentry.io/platforms/javascript/session-replay/#set-up" rel="noopener noreferrer"&gt;https://docs.sentry.io/platforms/javascript/session-replay/#set-up&lt;/a&gt;&lt;br&gt;
Giphy - Animated GIFs. &lt;a href="https://giphy.com/" rel="noopener noreferrer"&gt;https://giphy.com/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
      <category>javascript</category>
    </item>
    <item>
      <title>AWS SES Configuration: Setting Up Email Delivery in Laravel 🚀📧</title>
      <dc:creator>Suharxxxx</dc:creator>
      <pubDate>Mon, 14 Aug 2023 05:05:02 +0000</pubDate>
      <link>https://forem.com/suharyadi2112/aws-ses-configuration-setting-up-email-delivery-in-laravel-f50</link>
      <guid>https://forem.com/suharyadi2112/aws-ses-configuration-setting-up-email-delivery-in-laravel-f50</guid>
      <description>&lt;h2&gt;
  
  
  What's next ?🤔
&lt;/h2&gt;

&lt;p&gt;In the previous chapter &lt;a href="https://dev.to/suharyadi2112/optimize-email-delivery-in-laravel-using-aws-ses-smtp-28dp"&gt;Laravel Initial Setup: Preparing for AWS SES SMTP Integration&lt;/a&gt; We covered the setup of &lt;strong&gt;Laravel&lt;/strong&gt; for integrating &lt;strong&gt;AWS SES&lt;/strong&gt; email capabilities. In the current chapter, we'll shift our focus to the AWS side. Specifically, we'll explore the necessary configurations within &lt;strong&gt;AWS&lt;/strong&gt; to complement our &lt;strong&gt;Laravel&lt;/strong&gt; setup. By understanding this vital aspect, you'll gain insights into managing &lt;strong&gt;AWS&lt;/strong&gt; resources and ensuring seamless, dependable email delivery. Let's dive into the &lt;strong&gt;AWS&lt;/strong&gt; configuration details in this chapter.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/26ufnwz3wDUli7GU0/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/26ufnwz3wDUli7GU0/giphy.gif" width="500" height="281"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It's important to note that these steps are based on the AWS configuration as of the update in &lt;strong&gt;August 2023&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Let's kick 🚀🦶
&lt;/h2&gt;

&lt;p&gt;Things off with a simple guide to get started on the steps. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Before proceeding, it's essential to ensure that you've already logged into the &lt;strong&gt;AWS Management Console&lt;/strong&gt;, use the search feature to find "Amazon SES (Simple Email Service)" Once you're logged in, follow these steps:&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yjwCXwTb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/adbnqimpi3rxiluz59zc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yjwCXwTb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/adbnqimpi3rxiluz59zc.png" alt="Photo Seach Menu AWS Ses Service mail" width="800" height="141"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Access SMTP Settings&lt;/strong&gt; Begin by navigating to the SMTP settings within the Amazon &lt;strong&gt;SES service&lt;/strong&gt;, which you can conveniently locate on the left sidebar.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oC1clVnw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y8ulsu3pt0q8qk9kspzf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oC1clVnw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y8ulsu3pt0q8qk9kspzf.png" alt="Photo screenshot SMTP Dashboard" width="800" height="361"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SMTP Credential&lt;/strong&gt; Once you're on the SMTP settings dashboard, just click the &lt;strong&gt;Create SMTP Credential&lt;/strong&gt; button to generate the credentials needed for setting up secure email delivery via &lt;strong&gt;Amazon SES&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;u&gt;Specify User Details&lt;/u&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6210Mp08--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4jk37at3wranr9n0k8ec.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6210Mp08--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4jk37at3wranr9n0k8ec.png" alt="Photo Screenshot Specify User Detail Create SMTP Credential" width="800" height="392"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create SMTP User Set up an &lt;strong&gt;IAM user&lt;/strong&gt; specifically for &lt;strong&gt;SMTP authentication&lt;/strong&gt; with Amazon SES. &lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;The author chooses to keep the &lt;strong&gt;username as default&lt;/strong&gt;, without making any changes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Click on the &lt;strong&gt;Create User&lt;/strong&gt; button below to proceed with setting up your SMTP user.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;u&gt;Retrieve SMTP Credentials&lt;/u&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--j1vkKmOV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/68m67p6jxmnvqxt6j96c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--j1vkKmOV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/68m67p6jxmnvqxt6j96c.png" alt="Photo Screenshot Retrieve SMTP Credential" width="800" height="304"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After &lt;strong&gt;Create User&lt;/strong&gt; next step you'll &lt;strong&gt;Retrieve SMTP Credentials&lt;/strong&gt; In this step, you'll get the essential details you need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;IAM&lt;/strong&gt; Username&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SMTP&lt;/strong&gt; Username &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SMTP&lt;/strong&gt; Password&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can choose to &lt;strong&gt;download a CSV&lt;/strong&gt; file to keep this information stored securely for later use.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;u&gt;Back to Laravel&lt;/u&gt;
&lt;/h3&gt;

&lt;p&gt;Update your &lt;code&gt;.env&lt;/code&gt; to integrate the previously obtained &lt;strong&gt;SMTP Credentials&lt;/strong&gt;, return to your Laravel's &lt;code&gt;.env&lt;/code&gt; file, as we discussed in the previous chapter &lt;a href="https://dev.to/suharyadi2112/optimize-email-delivery-in-laravel-using-aws-ses-smtp-28dp"&gt;Laravel Initial Setup: Preparing for AWS SES SMTP Integration&lt;/a&gt;, fill in the following details :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="no"&gt;MAIL_MAILER&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;smtp&lt;/span&gt;
&lt;span class="no"&gt;MAIL_HOST&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;endpoint_SMTP&lt;/span&gt;
&lt;span class="no"&gt;MAIL_PORT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;587&lt;/span&gt; 
&lt;span class="no"&gt;MAIL_USERNAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;Username_SMTP&lt;/span&gt;
&lt;span class="no"&gt;MAIL_PASSWORD&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;Password_SMTP&lt;/span&gt;
&lt;span class="no"&gt;MAIL_ENCRYPTION&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;tls&lt;/span&gt;
&lt;span class="no"&gt;MAIL_FROM_ADDRESS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nc"&gt;Sender&lt;/span&gt; &lt;span class="nc"&gt;Mail&lt;/span&gt;
&lt;span class="no"&gt;MAIL_FROM_NAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"${APP_NAME}"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2InVCJDn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5bykzalmneo483f62b1b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2InVCJDn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5bykzalmneo483f62b1b.png" alt="Photo Screenshot .env configuration from AWS User SMTP" width="800" height="130"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Remember&lt;/strong&gt; to enter the &lt;code&gt;MAIL_USERNAME&lt;/code&gt; and &lt;code&gt;MAIL_PASSWORD&lt;/code&gt; you obtained while creating the &lt;strong&gt;Specify User Details&lt;/strong&gt; or from the downloaded CSV file. These credentials are vital for the successful integration of Amazon SES with your Laravel application.&lt;/p&gt;

&lt;p&gt;For &lt;strong&gt;MAIL_HOST&lt;/strong&gt; using &lt;strong&gt;SMTP endpoint&lt;/strong&gt; example &lt;code&gt;email-smtp.ap-southeast-2.amazonaws.com&lt;/code&gt;, &lt;strong&gt;MAIL_PORT&lt;/strong&gt; using &lt;code&gt;587&lt;/code&gt; and &lt;strong&gt;MAIL_ENCRYPTION&lt;/strong&gt; using &lt;code&gt;tls&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UMx8czBt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2qrpwfgdto3ydj9o3b4v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UMx8czBt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2qrpwfgdto3ydj9o3b4v.png" alt="Photo Screenshot dashboard SMTP Setting" width="800" height="327"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After preparing the configuration in the &lt;code&gt;.env&lt;/code&gt; file, the next step is to proceed with testing the &lt;strong&gt;email&lt;/strong&gt; sending functionality.&lt;/p&gt;

&lt;h3&gt;
  
  
  Testing
&lt;/h3&gt;

&lt;p&gt;Run your Laravel application on your computer with this simple command in the terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="n"&gt;php&lt;/span&gt; &lt;span class="n"&gt;artisan&lt;/span&gt; &lt;span class="n"&gt;serve&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OkYrcCWf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/guwasozbxyfftn84ie5d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OkYrcCWf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/guwasozbxyfftn84ie5d.png" alt="Screenshot running artisan laravel on command line" width="800" height="106"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Your &lt;strong&gt;Laravel application&lt;/strong&gt; is live on this URL and port: &lt;a href="http://localhost:8000"&gt;http://localhost:8000&lt;/a&gt;, you can access it using Postman or Insomnia for testing.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Before proceeding with email testing using AWS SES in Laravel, it's crucial to first register email verified identities within AWS SES.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This ensures smooth email delivery and ensures compliance with &lt;strong&gt;AWS SES&lt;/strong&gt; &lt;strong&gt;Sandbox&lt;/strong&gt; rules &lt;a href="https://docs.aws.amazon.com/id_id/ses/latest/dg/request-production-access.html"&gt;Moving out of the Amazon SES sandbox&lt;/a&gt;. By verifying identities in advance, you'll enable successful email communication in your &lt;strong&gt;Laravel application&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0qHPnJjI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j3i9xhsvik8h8hzrbayl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0qHPnJjI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j3i9xhsvik8h8hzrbayl.png" alt="Screenshot dashboard Verified Identities" width="800" height="326"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Not registering an email as a verified identity in AWS SES &lt;strong&gt;Sandbox&lt;/strong&gt; mode may lead to error responses &lt;a href="https://docs.aws.amazon.com/ses/latest/dg/troubleshoot-smtp.html#troubleshoot-smtp-response-codes"&gt;SMTP Response Code&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;To Create Verfied Identity&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Access AWS SES dashboard.&lt;/li&gt;
&lt;li&gt;Configuration settings.&lt;/li&gt;
&lt;li&gt;Verified identities.&lt;/li&gt;
&lt;li&gt;Enter the Create Identity Button.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hz0Cs3Wn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0lqkg9zkgco25eoh6w5a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hz0Cs3Wn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0lqkg9zkgco25eoh6w5a.png" alt="Create Identities Email Verified" width="800" height="791"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you've configured and verified your email identities, the next step is to send a &lt;strong&gt;verification email&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--N2nYth_h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ewerxurmydr278d4pglb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--N2nYth_h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ewerxurmydr278d4pglb.png" alt="Screenshot Verified Identities pending" width="800" height="361"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Verification email&lt;/strong&gt; done&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LdN29kJH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5jd3qsrsnn71py2yb5vb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LdN29kJH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5jd3qsrsnn71py2yb5vb.png" alt="Screenshot Verified Identities done(verified)" width="800" height="128"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You've created the verified identity within the AWS SES &lt;strong&gt;Sandbox&lt;/strong&gt; you can proceed with testing email delivery without any further obstacles.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Now&lt;/strong&gt;, open your API testing tool, such as Insomnia &lt;a href="https://insomnia.rest/"&gt;Insomnia&lt;/a&gt;, and make a GET request to:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XHXvDjq9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dkuo0mepc8pqu9gliv6b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XHXvDjq9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dkuo0mepc8pqu9gliv6b.png" alt="Route Testmail testing" width="800" height="142"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Please note that this route has been set up in a previous chapter &lt;a href="https://dev.to/suharyadi2112/optimize-email-delivery-in-laravel-using-aws-ses-smtp-28dp"&gt;Laravel Initial Setup: Preparing for AWS SES SMTP Integration&lt;/a&gt; during the &lt;strong&gt;Laravel project's initialization&lt;/strong&gt;. It's specifically designed for testing email sending functionality within your Laravel application.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Success Send Mail&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AcQ3YnLv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p8jbmvjacmhig7xfr8uv.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AcQ3YnLv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p8jbmvjacmhig7xfr8uv.jpg" alt="Success Send Mail" width="800" height="919"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;In AWS SES &lt;strong&gt;Sandbox&lt;/strong&gt; mode, remember to verify both the sender and recipient email addresses. If not, you might face a &lt;strong&gt;554&lt;/strong&gt; error, &lt;strong&gt;indicating email rejection&lt;/strong&gt;. &lt;a href="https://docs.aws.amazon.com/ses/latest/dg/request-production-access.html"&gt;Moving out of the Amazon SES sandbox&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--a6MUumtH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mb9y526di9qd2b8cgi9r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--a6MUumtH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mb9y526di9qd2b8cgi9r.png" alt="Screenshot fail if not register to verified identity" width="800" height="272"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Done
&lt;/h2&gt;

&lt;p&gt;You're all set to start sending emails with &lt;strong&gt;AWS SES in Laravel&lt;/strong&gt;. Don't forget to verify your email addresses in &lt;strong&gt;Sandbox&lt;/strong&gt; mode for smooth delivery. If you need help, this guide is here. Thanks for reading, and enjoy email communication using AWS SES and Laravel.🚀🌞&lt;br&gt;
&lt;a href="https://i.giphy.com/media/xUPJPDJKxwOIsq97W0/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/xUPJPDJKxwOIsq97W0/giphy.gif" width="480" height="270"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>aws</category>
      <category>php</category>
    </item>
    <item>
      <title>Laravel Initial Setup: Preparing for AWS SES SMTP Integration</title>
      <dc:creator>Suharxxxx</dc:creator>
      <pubDate>Thu, 10 Aug 2023 09:17:43 +0000</pubDate>
      <link>https://forem.com/suharyadi2112/optimize-email-delivery-in-laravel-using-aws-ses-smtp-28dp</link>
      <guid>https://forem.com/suharyadi2112/optimize-email-delivery-in-laravel-using-aws-ses-smtp-28dp</guid>
      <description>&lt;p&gt;Welcome! In this guide, we will assist you in integrating the power of &lt;strong&gt;AWS SES&lt;/strong&gt;, &lt;strong&gt;SMTP&lt;/strong&gt;, and &lt;strong&gt;Laravel 8 Version&lt;/strong&gt; for reliable email delivery. With easy-to-follow steps, you'll master this integration and enhance email communication efficiency. Let's get started!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/l2JhJmZxibUVOMAPm/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/l2JhJmZxibUVOMAPm/giphy.gif" width="500" height="281"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Amazon Simple Email Service (SES)
&lt;/h2&gt;

&lt;p&gt;Is an email platform that provides an easy, cost-effective way for you to send and receive email using your own email addresses and domains.&lt;/p&gt;

&lt;p&gt;For example, you can send marketing emails such as special offers, transactional emails such as order confirmations, and other types of correspondence such as newsletters. When you use Amazon SES to receive mail, you can develop software solutions such as email autoresponders, email unsubscribe systems, and applications that generate customer support tickets from incoming emails. &lt;a href="https://docs.aws.amazon.com/ses/latest/dg/Welcome.html"&gt;Amazon Simple Email Service (SES)&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Amazon SES sends email using SMTP
&lt;/h2&gt;

&lt;p&gt;Which is the most common email protocol on the internet. You can send email through Amazon SES by using a variety of SMTP-enabled programming languages and software to connect to the Amazon SES SMTP interface. This section explains how to get your Amazon SES SMTP credentials, how to send email by using the SMTP interface, and how to configure several pieces of software and mail servers to use Amazon SES for email sending. &lt;a href="https://docs.aws.amazon.com/ses/latest/dg/send-email-smtp.html"&gt;send-email-smtp&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Create Mail Class
&lt;/h2&gt;

&lt;p&gt;Create a new mail class using, this enables you to craft custom email templates tailored to your project's needs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php artisan make:mail NotifyMail
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;NotifyMail.php created Mail folder &lt;code&gt;app/Mail&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cyj3lDBw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nr1f4leu6agyr25thyyk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cyj3lDBw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nr1f4leu6agyr25thyyk.png" alt="Screenshot Location NotifyMail File" width="327" height="90"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kn"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;App\Mail&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Illuminate\Bus\Queueable&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Illuminate\Contracts\Queue\ShouldQueue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Illuminate\Mail\Mailable&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Illuminate\Queue\SerializesModels&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;NotifyMail&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Mailable&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Queueable&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;SerializesModels&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;__construct&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="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;build&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;view&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'mail.setmail'&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Focus on.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;This is the declaration of the &lt;code&gt;build()&lt;/code&gt; method, which is used to construct the email content.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;mail.setmail&lt;/code&gt; is the name of the view to be used, this name points to the view located in the &lt;code&gt;resources/views/mail&lt;/code&gt; directory, with the file name &lt;strong&gt;setmail.blade.php.&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Create Controller
&lt;/h2&gt;

&lt;p&gt;The command  generates a new controller that's specifically meant to handle sending email.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php artisan make:controller ManageMail\SendEmailController
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;located in the &lt;code&gt;app/Http/Controllers/ManageMail&lt;/code&gt; directory.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JzOamfG3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cfqwkht1fun0m0mbs3ni.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JzOamfG3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cfqwkht1fun0m0mbs3ni.png" alt="Location File SendEmailController" width="329" height="52"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kn"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;App\Http\Controllers\ManageMail&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;App\Http\Controllers\Controller&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Illuminate\Http\Request&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Mail&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;App\Mail\NotifyMail&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;SendEmailController&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Controller&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="nc"&gt;Mail&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;to&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'yadisuhar05@gmail.com'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;send&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;NotifyMail&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
          &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Mail&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;failures&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
               &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;response&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="s1"&gt;'msg'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Fail'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
          &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
               &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;response&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="s1"&gt;'msg'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Success'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="mi"&gt;200&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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By importing these classes, you're setting up your code to utilize Laravel's email features. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This makes it simple to send emails using the &lt;code&gt;use Mail&lt;/code&gt; facade and to structure the content and settings of the email you want to send by utilizing the &lt;code&gt;use NotifyMail&lt;/code&gt; class.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Mail::to&lt;/code&gt; Sends an email to the specified email address &lt;code&gt;yadisuhar05@gmail.com&lt;/code&gt;, The email content are defined in the &lt;code&gt;NotifyMail&lt;/code&gt; class.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Create Route
&lt;/h2&gt;

&lt;p&gt;This route is used to test email sending through the action defined within the &lt;code&gt;SendEmailController&lt;/code&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;To create a route in Laravel, you need to import the relevant controller that contains the logic for handling the route.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;App\Http\Controllers\ManageMail\SendEmailController&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nc"&gt;Route&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/testmail'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;SendEmailController&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'index'&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Create Views
&lt;/h2&gt;

&lt;p&gt;Created file blade &lt;code&gt;setmail.blade.php&lt;/code&gt; located in the &lt;code&gt;resources/views/mail&lt;/code&gt; directory.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;based on Mail Class&lt;/strong&gt; NotifyMail.php&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;return $this-&amp;gt;view('mail.setmail');&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Make a simple page &lt;code&gt;setmail.blade.php&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Example Email&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;

   &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;AWS SES Configuration: Setting Up Email Delivery in Laravel&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--750Ra5-7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/90wg1rhspsoqq4ud598k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--750Ra5-7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/90wg1rhspsoqq4ud598k.png" alt="Location Views File setmail.blade.php" width="337" height="324"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Set MAIL SMTP .env
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yp1D4cTu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t22ssqrrti6l4wiynqsw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yp1D4cTu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t22ssqrrti6l4wiynqsw.png" alt="Screenshot .env configuration" width="412" height="128"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the next chapter, we'll configure Laravel's &lt;code&gt;.env&lt;/code&gt; file, where we'll input the needed credentials, including the &lt;strong&gt;username&lt;/strong&gt; and &lt;strong&gt;password&lt;/strong&gt;, for sending emails through &lt;strong&gt;AWS SES SMTP&lt;/strong&gt;. This step is key for ensuring secure and efficient email communication. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/UwrdbvJz1CNck/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/UwrdbvJz1CNck/giphy.gif" width="480" height="270"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With all the prepared components. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;mail class&lt;/li&gt;
&lt;li&gt;controller &lt;/li&gt;
&lt;li&gt;views&lt;/li&gt;
&lt;li&gt;routes &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You have a strong foundation for managing email sending in your Laravel project. However, it's important to note that actual email sending cannot be done until you've successfully configured AWS SES and SMTP, which will be covered in the &lt;strong&gt;next chapter.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>webdev</category>
      <category>productivity</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Programmer's Potion, Unleashing Your Coding Powers with Morning Drinks</title>
      <dc:creator>Suharxxxx</dc:creator>
      <pubDate>Thu, 22 Jun 2023 04:29:05 +0000</pubDate>
      <link>https://forem.com/suharyadi2112/programmers-potion-unleashing-your-coding-powers-with-morning-drinks-1kim</link>
      <guid>https://forem.com/suharyadi2112/programmers-potion-unleashing-your-coding-powers-with-morning-drinks-1kim</guid>
      <description>&lt;p&gt;&lt;strong&gt;Starting&lt;/strong&gt; your morning with a boost of energy is crucial for tackling complex and challenging tasks. In this article, we'll introduce you to the ideal drinks that will awaken your senses in the morning and help you face the workday with focus and high productivity. So get ready to discover beverage options that will turn you into a programmer ready to take on each morning!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/pzryvxGeykOxeC0fWb/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/pzryvxGeykOxeC0fWb/giphy.gif" width="600" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here are some suitable options to consume in the morning 😎&lt;/p&gt;

&lt;h2&gt;
  
  
  Water💧
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lH6X0pfM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mtvynwqudmvdd1xzxq1v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lH6X0pfM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mtvynwqudmvdd1xzxq1v.png" alt="Image description" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Although&lt;/strong&gt; it may seem simple, drinking water in the morning is crucial to maintain hydration after hours of not drinking during sleep. Dehydration can lead to decreased energy and concentration. So, make sure to drink a glass of water when you wake up.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/m5of6ouIA4TFm/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/m5of6ouIA4TFm/giphy.gif" width="500" height="375"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A fun fact about drinking &lt;strong&gt;water&lt;/strong&gt; that you may not be aware of&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Approximately 70% of the human body is composed of water. This means that water is crucial for the normal functioning of our bodies.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Water helps maintain body temperature, transports nutrients to cells, lubricates joints, and eliminates waste through urine.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In addition, drinking water can improve brain function. Mild dehydration can affect concentration, mental sharpness, and mood.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;By consuming enough water, we can help keep the brain focused and functioning optimally.😀&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Coffee ☕
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--polFFS3h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/058fjjs5cq2e4u0cxei0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--polFFS3h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/058fjjs5cq2e4u0cxei0.png" alt="Image description" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Coffee&lt;/strong&gt; is a commonly consumed beverage in the morning by many people, including programmers. The caffeine content in coffee can help improve alertness and concentration. 😎 However, make sure not to consume too much coffee to avoid disrupting sleep or causing restlessness. 😴&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/fjahbcT4EpzqB9inOU/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/fjahbcT4EpzqB9inOU/giphy.gif" width="480" height="270"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A fun fact about drinking &lt;strong&gt;coffee&lt;/strong&gt; that you may not be aware of&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Coffee contains caffeine, a stimulant that can boost energy and help keep us awake. The caffeine content in a cup of coffee can vary, but on average, black coffee contains around 95 mg of caffeine.😉&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When consumed in moderation, coffee can have some health benefits. Some studies suggest that coffee may reduce the risk of liver disease, type 2 diabetes, Parkinson's disease, and certain types of cancer. 👍&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Green tea 🍵
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jgZazCLV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7bgfhl9r1cavv4p8x366.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jgZazCLV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7bgfhl9r1cavv4p8x366.png" alt="Image description" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Green tea&lt;/strong&gt; contains lower levels of caffeine compared to coffee, but it can still provide a gentle stimulating effect. Green tea is also rich in antioxidants and has other health benefits.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/ym6PmLonLGfv2/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/ym6PmLonLGfv2/giphy.gif" width="500" height="267"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A fun fact about drinking &lt;strong&gt;Green Tea&lt;/strong&gt; that you may not be aware of&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Matcha, a type of powdered green tea, is renowned for its vibrant green color. The intense green hue is a result of the shade-grown process used to cultivate the tea leaves. By covering the tea plants from direct sunlight for a few weeks before harvesting, the leaves produce more chlorophyll, resulting in the rich green color.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Green tea can be enjoyed hot or cold. While it is commonly consumed as a hot beverage, green tea is also delicious when brewed and served over ice. Iced green tea is a refreshing option, especially during hot summer months&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In addition, green tea contains fluoride, which can contribute to maintaining good oral health. Fluoride helps strengthen tooth enamel, making it more resistant to decay and cavities. By incorporating green tea into your oral care routine, you can potentially promote healthier teeth and gums.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Smoothie 🍓
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xYYfgDuR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hwfyv2432ej87pnxn2kz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xYYfgDuR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hwfyv2432ej87pnxn2kz.png" alt="Image description" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;Smoothie&lt;/strong&gt; is a beverage made from a blend of fresh or frozen fruits, vegetables, yogurt, milk, or other ingredients. Typically, these ingredients are blended together until smooth, resulting in a thick yet creamy texture. Smoothies are often served cold and can be enhanced with the addition of ice for a refreshing sensation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/3ohzAoZG9dPZ0Y0AZG/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/3ohzAoZG9dPZ0Y0AZG/giphy.gif" width="480" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A fun fact about drinking &lt;strong&gt;Smoothie&lt;/strong&gt; that you may not be aware of&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;High Nutrient Intake, Smoothies made from fresh ingredients like fruits and vegetables can provide a high intake of nutrients, including vitamins, minerals, fiber, and antioxidants. This helps strengthen the immune system, maintain heart health, and support overall bodily functions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Healthy Food Alternative, Smoothies can be used as a healthy food alternative, especially for those with limited time to eat or who want to consume nutrients in a quicker and more convenient way.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Improves Hydration, Many smoothies contain liquid ingredients like coconut water, orange juice, or milk, which can help improve hydration. This is particularly important during hot weather or after physical activities.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Coconut Water 🥥
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JQYprKLm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o72nx6ibjql7dwe07yi6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JQYprKLm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o72nx6ibjql7dwe07yi6.png" alt="Image description" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Natural &lt;strong&gt;coconut water&lt;/strong&gt; contains electrolytes and nutrients that aid in hydrating the body. It's a healthy alternative to commercially available sports drinks that often contain added sugars.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/IhaMKaMx5phwNuskK2/giphy-downsized.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/IhaMKaMx5phwNuskK2/giphy-downsized.gif" width="384" height="216"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A fun fact about drinking &lt;strong&gt;Coconut Water&lt;/strong&gt; that you may not be aware of&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Coconut water is a natural source of electrolytes and essential nutrients for the body. Dancing coconut water can help replenish lost fluids and maintain optimal hydration.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Coconut water contains electrolytes such as potassium, sodium, magnesium, and calcium. Dancing coconut water can help restore electrolyte balance in the body after intense physical activity or fluid loss.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Coconut water contains several essential nutrients such as vitamin C, B-complex vitamins, enzymes, and amino acids. Dancing coconut water can provide additional nutrition to support overall health.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thank you for reading this article on dev.to. I hope the information I've shared has been beneficial and provided new insights for you in the world of development. Feel free to leave comments or share this article with the dev.to community. See you in the next article!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/mP8GermRyOFWV8PQeq/giphy-downsized.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/mP8GermRyOFWV8PQeq/giphy-downsized.gif" width="480" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>productivity</category>
      <category>community</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Optimizing Logs Utilizing Logrus to Record Logs to a File</title>
      <dc:creator>Suharxxxx</dc:creator>
      <pubDate>Wed, 14 Jun 2023 07:39:22 +0000</pubDate>
      <link>https://forem.com/suharyadi2112/optimizing-logs-utilizing-logrus-to-record-logs-to-a-file-5891</link>
      <guid>https://forem.com/suharyadi2112/optimizing-logs-utilizing-logrus-to-record-logs-to-a-file-5891</guid>
      <description>&lt;h2&gt;
  
  
  &lt;a href="https://github.com/sirupsen/logrus" rel="noopener noreferrer"&gt;Logrus&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;is a logging library for Go programming language that simplifies the process of recording logs to a file. It offers a clean and intuitive API, making it easy to implement and customize logging functionalities according to your specific needs. With Logrus, you can improve the efficiency of your logs, making them more organized, informative, and easily manageable.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/3o6Ztk7NosfLVRqcpy/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/3o6Ztk7NosfLVRqcpy/giphy.gif"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;

&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="s"&gt;"os"&lt;/span&gt;
  &lt;span class="s"&gt;"github.com/sirupsen/logrus"&lt;/span&gt;
  &lt;span class="s"&gt;"errors"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c"&gt;// Create a new instance of the logger. You can have any number of instances.&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;log&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;logrus&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;New&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;init&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c"&gt;// Log as JSON instead of the default ASCII formatter.&lt;/span&gt;
  &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SetFormatter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;logrus&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;JSONFormatter&lt;/span&gt;&lt;span class="p"&gt;{})&lt;/span&gt;
  &lt;span class="c"&gt;// Only log the debug severity or above.&lt;/span&gt;
  &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SetLevel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;logrus&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;DebugLevel&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="s"&gt;"LogrusToLogFile"&lt;/span&gt; &lt;span class="c"&gt;//context&lt;/span&gt;

  &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Out&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Stdout&lt;/span&gt;
  &lt;span class="c"&gt;// You could set this to any `io.Writer` such as a file&lt;/span&gt;
  &lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;OpenFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"logrus.log"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;O_CREATE&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;O_WRONLY&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;O_APPEND&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0666&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Out&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Failed to log to file, using default stderr"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c"&gt;//make fake error&lt;/span&gt;
  &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;errors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;New&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"math: square root of negative number"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WithFields&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;logrus&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Fields&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="s"&gt;"ctx"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Write to file"&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;In the given code, we use the Logrus library to log messages to a file, import the necessary packages such as.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;"os"&lt;/code&gt; for system operations. &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;"github.com/sirupsen/logrus"&lt;/code&gt; for Logrus&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;"errors"&lt;/code&gt; to define an error.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="s"&gt;"os"&lt;/span&gt;
  &lt;span class="s"&gt;"github.com/sirupsen/logrus"&lt;/span&gt;
  &lt;span class="s"&gt;"errors"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;We create a new instance of the logger using &lt;code&gt;logrus.New()&lt;/code&gt; Then, we set the log formatter to &lt;strong&gt;JSONFormatter&lt;/strong&gt; to generate logs in JSON format. SetLevel is used to specify the logging level.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;

&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;log&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;logrus&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;New&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;init&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c"&gt;// Log as JSON instead of the default ASCII formatter.&lt;/span&gt;
  &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SetFormatter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;logrus&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;JSONFormatter&lt;/span&gt;&lt;span class="p"&gt;{})&lt;/span&gt;
  &lt;span class="c"&gt;// Only log the debug severity or above.&lt;/span&gt;
  &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SetLevel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;logrus&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;DebugLevel&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;blockquote&gt;
&lt;p&gt;which is set to &lt;strong&gt;debug&lt;/strong&gt; level in this example.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;

 &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Out&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Stdout&lt;/span&gt;
  &lt;span class="c"&gt;// You could set this to any `io.Writer` such as a file&lt;/span&gt;
  &lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;OpenFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"logrus.log"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;O_CREATE&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;O_WRONLY&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;O_APPEND&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0666&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Out&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Failed to log to file, using default stderr"&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;In the main function, we perform several configurations for the logger. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;we set logrus to log messages to os.Stdout as the default output. - we attempt to open the "logrus.log" file to log messages into it. - If successful, we set log.Out to use the file as the log output. - If there is an error, we print an informational message stating that logging to the file failed and fall back to using os.Stderr as the output.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;

&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;OpenFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"logrus.log"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;O_CREATE&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;O_WRONLY&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;O_APPEND&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0666&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Here's the breakdown of the arguments used in the &lt;code&gt;OpenFile()&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;logrus.log&lt;/code&gt; is a string representing the file name that will be opened or created. In this example, the file name used is "logrus.log".&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;os.O_CREATE|os.O_WRONLY|os.O_APPEND&lt;/code&gt; is a combination of flags that determine the operations to be performed on the file.

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;os.O_CREATE&lt;/code&gt; is used to create the file if it doesn't exist.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;os.O_WRONLY&lt;/code&gt; is used to open the file in write-only mode.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;os.O_APPEND&lt;/code&gt; is used to append data to the file if it already exists.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;
&lt;code&gt;0666&lt;/code&gt;is the file mode that specifies the permissions for the created file. In this example, the mode &lt;code&gt;0666&lt;/code&gt;allows the user, group, and others to read and write the file.&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;

&lt;span class="c"&gt;//make fake error&lt;/span&gt;
  &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;errors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;New&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"math: square root of negative number"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WithFields&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;logrus&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Fields&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="s"&gt;"ctx"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Write to file"&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;We create a fake error using &lt;code&gt;errors.New()&lt;/code&gt;. If the error is not nil, we use &lt;code&gt;logrus.WithFields&lt;/code&gt; to add additional information to the log, in this case, the "ctx" field. Then, we log an error message using &lt;code&gt;logrus.Error&lt;/code&gt;/ &lt;code&gt;Error("Write to file")&lt;/code&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhcavmi306nvlx6k86i0d.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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhcavmi306nvlx6k86i0d.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You will execute the command go run log_logrus.go to run a Go program called log_logrus.go. This program utilizes the Logrus library to record logs to a file.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuxuy6x2gyfjijyjm6q3x.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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuxuy6x2gyfjijyjm6q3x.png" alt="Image description"&gt;&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnt2ie5i96w0ev374b0gd.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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnt2ie5i96w0ev374b0gd.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By configuring Logrus to log messages to a file, we can record logs into the "logrus.log" file. This can be helpful for monitoring and analyzing application logs more efficiently.&lt;/p&gt;

&lt;p&gt;Overall, the code is a simple example of using Logrus to log messages to a file with appropriate configurations and error handling.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/xonOzxf2M8hNu/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/xonOzxf2M8hNu/giphy.gif"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In conclusion&lt;/strong&gt; optimizing logs is crucial for efficient application development and maintenance. By utilizing Logrus, a powerful logging library for the Go programming language, you can simplify the process of recording logs to a file and enhance the effectiveness of your logging system.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/sirupsen/logrus" rel="noopener noreferrer"&gt;https://github.com/sirupsen/logrus&lt;/a&gt;&lt;/p&gt;

</description>
      <category>go</category>
      <category>beginners</category>
      <category>discuss</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Simplify Logging in Go Applications Configuration Logrus</title>
      <dc:creator>Suharxxxx</dc:creator>
      <pubDate>Tue, 13 Jun 2023 04:13:19 +0000</pubDate>
      <link>https://forem.com/suharyadi2112/logrus-simplify-logging-in-go-applications-configuration-1j2a</link>
      <guid>https://forem.com/suharyadi2112/logrus-simplify-logging-in-go-applications-configuration-1j2a</guid>
      <description>&lt;h2&gt;
  
  
  Logrus
&lt;/h2&gt;

&lt;p&gt;is a structured logger for Go (golang), completely API compatible with the standard library logger, popular logging library that provides extensive features and flexibility for logging in Go applications. &lt;a href="https://github.com/sirupsen/logrus" rel="noopener noreferrer"&gt;logrus&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/25KEhzwCBBFPb79puo/giphy-downsized.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/25KEhzwCBBFPb79puo/giphy-downsized.gif"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;First, we import the log package from &lt;a href="//github.com/sirupsen/logrus"&gt;logrus&lt;/a&gt;, which is the official Logrus package. Logrus is a popular logging library for Go that provides powerful &lt;strong&gt;features and flexibility&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="c"&gt;// "os"&lt;/span&gt;
  &lt;span class="n"&gt;log&lt;/span&gt; &lt;span class="s"&gt;"github.com/sirupsen/logrus"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the code snippet, the log package is aliased as log from the &lt;a href="//github.com/sirupsen/logrus"&gt;logrus&lt;/a&gt; package. This allows you to use the Logrus library under the log &lt;strong&gt;namespace&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example
&lt;/h2&gt;

&lt;p&gt;The easiest approach to utilize Logrus is by utilizing the logger exported at the package level.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;log&lt;/span&gt; &lt;span class="s"&gt;"github.com/sirupsen/logrus"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WithFields&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Fields&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s"&gt;"animal"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"walrus"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"A walrus appears"&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;The code snippet above demonstrates the usage of Logrus, a logging library in Go. In the  function, we use the  method to attach additional information to a log entry before printing it &lt;code&gt;WithFields()&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In this example, we create a log entry with the field  set to . This field represents the type of animal that appears in the log entry.&lt;code&gt;animal : walrus&lt;/code&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbyw2s5f3bi3sbo9fmsj1.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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbyw2s5f3bi3sbo9fmsj1.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Certainly! Here's a simplified explanation of the different error levels in Logrus :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Error&lt;/strong&gt;: Used for critical errors in the application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Warn&lt;/strong&gt;: Used for non-critical warnings that require attention.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Info&lt;/strong&gt;: Used for informative messages to track important events.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Debug&lt;/strong&gt;: Used for debugging purposes during development.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fatal&lt;/strong&gt;: Used for fatal errors that cause the application to stop abruptly.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;log&lt;/span&gt; &lt;span class="s"&gt;"github.com/sirupsen/logrus"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WithFields&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Fields&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s"&gt;"animal"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"cat"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"A walrus appears"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WithFields&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Fields&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s"&gt;"animal"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"fish"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Debug&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"A walrus appears"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WithFields&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Fields&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s"&gt;"animal"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"walrus"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"A walrus appears"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WithFields&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Fields&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s"&gt;"animal"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"dog"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Warn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"A walrus appears"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WithFields&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Fields&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s"&gt;"animal"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"pig"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Fatal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"A walrus appears"&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;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fas77zv8614ubh7ctj46j.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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fas77zv8614ubh7ctj46j.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;init&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c"&gt;// Log as JSON instead of the default ASCII formatter.&lt;/span&gt;
  &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SetFormatter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;JSONFormatter&lt;/span&gt;&lt;span class="p"&gt;{})&lt;/span&gt;
  &lt;span class="c"&gt;// Only log the warning severity or above.&lt;/span&gt;
  &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SetLevel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;DebugLevel&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;blockquote&gt;
&lt;p&gt;This code should be included in your application's initialization phase. It configures Logrus to use JSON formatting for log output and sets the log level to include debug messages.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt; with fake error.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;log&lt;/span&gt; &lt;span class="s"&gt;"github.com/sirupsen/logrus"&lt;/span&gt;
  &lt;span class="s"&gt;"errors"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;init&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c"&gt;// Log as JSON instead of the default ASCII formatter.&lt;/span&gt;
  &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SetFormatter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;JSONFormatter&lt;/span&gt;&lt;span class="p"&gt;{})&lt;/span&gt;
  &lt;span class="c"&gt;// Only log the debug severity or above.&lt;/span&gt;
  &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SetLevel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;DebugLevel&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="s"&gt;"TestLogrus"&lt;/span&gt; &lt;span class="c"&gt;//context&lt;/span&gt;
  &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;errors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;New&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"math: square root of negative number"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WithFields&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Fields&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s"&gt;"ctx"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Error&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;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faroj8anirv6bxr7xmiqs.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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faroj8anirv6bxr7xmiqs.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The code snippet provided demonstrates a basic implementation of Logrus in a Go application. Here's a simple explanation of what the code does:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;An error variable err is created using the errors.New function. In this example, the error message states "math: square root of negative number".&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The code checks if the error variable is not nil, indicating the occurrence of an error.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If an error exists, the Logrus WithFields function is used to add additional fields to the log entry. In this case, the ctx field is included with the value of the ctx variable.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Finally, the Error method is called on the Logrus logger to log the error message. The error message itself is retrieved using err.Error().&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Additional&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;init&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c"&gt;// Log as JSON instead of the default ASCII formatter.&lt;/span&gt;
  &lt;span class="c"&gt;// log.SetFormatter(&amp;amp;log.JSONFormatter{})&lt;/span&gt;
  &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SetFormatter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;TextFormatter&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;DisableColors&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="no"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;FullTimestamp&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;ForceColors&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="c"&gt;// Only log the warning severity or above.&lt;/span&gt;
  &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SetLevel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;DebugLevel&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;blockquote&gt;
&lt;p&gt;When a TTY is attached, otherwise just plain text&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp2pyhodwbhgavwrb55jb.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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp2pyhodwbhgavwrb55jb.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;*&lt;a href="https://github.com/sirupsen/logrus" rel="noopener noreferrer"&gt;https://github.com/sirupsen/logrus&lt;/a&gt;&lt;/p&gt;

</description>
      <category>go</category>
      <category>beginners</category>
      <category>codepen</category>
      <category>testing</category>
    </item>
    <item>
      <title>Adding Context to Sentry for Simplified Issue Analysis</title>
      <dc:creator>Suharxxxx</dc:creator>
      <pubDate>Wed, 28 Dec 2022 04:00:17 +0000</pubDate>
      <link>https://forem.com/suharyadi2112/adding-context-to-sentry-for-simplified-issue-analysis-20b2</link>
      <guid>https://forem.com/suharyadi2112/adding-context-to-sentry-for-simplified-issue-analysis-20b2</guid>
      <description>&lt;h2&gt;
  
  
  Context in Sentry
&lt;/h2&gt;

&lt;p&gt;Refers to additional information that can be added to an error message or message sent to Sentry. Context usually contains information that is useful for &lt;u&gt;analyzing and resolving&lt;/u&gt; issues in your application.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/XIahGhbK5A685fyr8D/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/XIahGhbK5A685fyr8D/giphy.gif"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Examples of information that can be added as context include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;User information: Information about the user experiencing the issue.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Extra data: Additional data that is useful for analyzing the issue.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Context can be added to an error message or message using methods such as SetExtra, and SetUser in Sentry.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;

&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"log"&lt;/span&gt;
    &lt;span class="s"&gt;"time"&lt;/span&gt;
    &lt;span class="s"&gt;"errors"&lt;/span&gt;
    &lt;span class="s"&gt;"github.com/getsentry/sentry-go"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;sentry&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Init&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sentry&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ClientOptions&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;Dsn&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"YOUR DSN"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;Debug&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Fatalf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"sentry.Init: %s"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;defer&lt;/span&gt; &lt;span class="n"&gt;sentry&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Flush&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;2&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Second&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;sentry&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WithScope&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;scope&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;sentry&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Scope&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

        &lt;span class="c"&gt;// set context character&lt;/span&gt;
        &lt;span class="n"&gt;scope&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SetContext&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"character"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;map&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="k"&gt;interface&lt;/span&gt;&lt;span class="p"&gt;{}{&lt;/span&gt;
            &lt;span class="s"&gt;"name"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;        &lt;span class="s"&gt;"Mighty Fighter"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s"&gt;"age"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;         &lt;span class="m"&gt;19&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s"&gt;"attack_type"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"melee"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;})&lt;/span&gt;

        &lt;span class="c"&gt;//add extra data additional&lt;/span&gt;
        &lt;span class="n"&gt;scope&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SetExtra&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"extra_key"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"extra_value"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="c"&gt;//set user id&lt;/span&gt;
        &lt;span class="n"&gt;scope&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SetUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sentry&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;User&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;ID&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"user_id_example"&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
        &lt;span class="c"&gt;//exemple error, fake err&lt;/span&gt;
        &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;errors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;New&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Example Error 4"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="c"&gt;//capture error and level error&lt;/span&gt;
        &lt;span class="n"&gt;scope&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SetLevel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sentry&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;LevelError&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;sentry&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CaptureException&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;err&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Some examples in implementation when sending to sentry.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx12vnw1cvzsendh7b4wz.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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx12vnw1cvzsendh7b4wz.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set context character information&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;

&lt;span class="c"&gt;// set context character&lt;/span&gt;
&lt;span class="n"&gt;scope&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SetContext&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"character"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;map&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="k"&gt;interface&lt;/span&gt;&lt;span class="p"&gt;{}{&lt;/span&gt;
    &lt;span class="s"&gt;"name"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;        &lt;span class="s"&gt;"Mighty Fighter"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s"&gt;"age"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;         &lt;span class="m"&gt;19&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s"&gt;"attack_type"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"melee"&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;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk4r12bndr4lbnce7uf72.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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk4r12bndr4lbnce7uf72.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set extra data additional&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;

&lt;span class="c"&gt;//add extra data additional&lt;/span&gt;
&lt;span class="n"&gt;scope&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SetExtra&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"extra_key"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"extra_value"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxzzozy012flssnnfxh5k.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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxzzozy012flssnnfxh5k.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set user id&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;

&lt;span class="n"&gt;scope&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SetUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sentry&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;User&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;ID&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"user_id_example"&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnyo6ey6mhk755k9vnwif.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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnyo6ey6mhk755k9vnwif.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Learn more about context Sentry.&lt;br&gt;
&lt;a href="https://docs.sentry.io/platforms/go/enriching-events/context/" rel="noopener noreferrer"&gt;https://docs.sentry.io/platforms/go/enriching-events/context/&lt;/a&gt;&lt;br&gt;
Learn more about conventions for common contexts in the contexts interface developer documentation.&lt;br&gt;
&lt;a href="https://develop.sentry.dev/sdk/event-payloads/contexts/" rel="noopener noreferrer"&gt;https://develop.sentry.dev/sdk/event-payloads/contexts/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>go</category>
      <category>beginners</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Convert date to easy read PHP</title>
      <dc:creator>Suharxxxx</dc:creator>
      <pubDate>Mon, 26 Dec 2022 06:29:55 +0000</pubDate>
      <link>https://forem.com/suharyadi2112/convert-date-to-easy-read-php-1bf5</link>
      <guid>https://forem.com/suharyadi2112/convert-date-to-easy-read-php-1bf5</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv335if77w5c60acu4dni.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv335if77w5c60acu4dni.png" alt="Image description" width="800" height="387"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.tehplayground.com/IjqAmFSaY1eS2y9Q" rel="noopener noreferrer"&gt;https://www.tehplayground.com/IjqAmFSaY1eS2y9Q&lt;/a&gt;&lt;/p&gt;

</description>
      <category>100daysofcode</category>
      <category>learning</category>
    </item>
    <item>
      <title>Set Level Error Sentry Golang</title>
      <dc:creator>Suharxxxx</dc:creator>
      <pubDate>Sat, 24 Dec 2022 08:44:42 +0000</pubDate>
      <link>https://forem.com/suharyadi2112/set-level-error-sentry-golang-5e69</link>
      <guid>https://forem.com/suharyadi2112/set-level-error-sentry-golang-5e69</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://sentry.io/welcome/" rel="noopener noreferrer"&gt;https://sentry.io/welcome/&lt;/a&gt;&lt;br&gt;
Track errors &amp;amp; monitor performance in all major languages &amp;amp; frameworks with Sentry&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The scope can include information about the environment in which the error occurred, the user who experienced the error, and any additional context that might be relevant to understanding and debugging the error.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://docs.sentry.io/platforms/go/enriching-events/scopes/#whats-a-scope-whats-a-hub" rel="noopener noreferrer"&gt;https://docs.sentry.io/platforms/go/enriching-events/scopes/#whats-a-scope-whats-a-hub&lt;/a&gt;&lt;br&gt;
information about Scope Sentry&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A level Error could refer to a variety of issues in programming, depending on the context. It could be a syntax error, meaning there is a problem with the way the code is written and the interpreter or compiler cannot understand it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbph5d6ecbi6g70ajohu0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbph5d6ecbi6g70ajohu0.png" alt="Image description" width="800" height="1161"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;specify the details in the error level selection in sentry, you can use the error level you want.
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftmzii5krlv8yj81pnwi5.png" alt="Image description" width="800" height="681"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;results if it has been recorded in the issue sentry&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Info level
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fknjfiq0cqzs9kyakppl7.jpg" alt="Image description" width="438" height="204"&gt;
&lt;/li&gt;
&lt;li&gt;Error level
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzztsuh0odgegns3ka6ck.jpg" alt="Image description" width="441" height="198"&gt;
&lt;/li&gt;
&lt;li&gt;Warning level
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1jt599iot9ncz267lszg.jpg" alt="Image description" width="434" height="213"&gt;
&lt;/li&gt;
&lt;li&gt;Debug level
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F09ystkrlzve5594trz0u.jpg" alt="Image description" width="438" height="221"&gt;
&lt;/li&gt;
&lt;li&gt;Fatal level
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5vbyu3zf7g4njzxnbkgg.jpg" alt="Image description" width="434" height="203"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Detail about level Sentry &lt;a href="https://docs.sentry.io/platforms/go/usage/set-level/" rel="noopener noreferrer"&gt;https://docs.sentry.io/platforms/go/usage/set-level/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Detail Code&lt;br&gt;
&lt;a href="https://go.dev/play/p/13OSDupdxWh" rel="noopener noreferrer"&gt;https://go.dev/play/p/13OSDupdxWh&lt;/a&gt;&lt;/p&gt;

</description>
      <category>watercooler</category>
    </item>
    <item>
      <title>Configuration Sentry Golang</title>
      <dc:creator>Suharxxxx</dc:creator>
      <pubDate>Fri, 23 Dec 2022 04:11:51 +0000</pubDate>
      <link>https://forem.com/suharyadi2112/test-1k25</link>
      <guid>https://forem.com/suharyadi2112/test-1k25</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://sentry.io/welcome/" rel="noopener noreferrer"&gt;https://sentry.io/welcome/&lt;/a&gt;&lt;br&gt;
Track errors &amp;amp; monitor performance in all major languages &amp;amp; frameworks with Sentry&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://go.dev/play/p/uFHluuK7-84" rel="noopener noreferrer"&gt;https://go.dev/play/p/uFHluuK7-84&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frtkfkij4ezphmy92wzrh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frtkfkij4ezphmy92wzrh.png" alt="Image description" width="800" height="537"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;create a new project, pick golang&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo2qpezhv7mfmrqzik0og.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo2qpezhv7mfmrqzik0og.png" alt="Image description" width="763" height="362"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyi4u6dkouzerz5r78o1b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyi4u6dkouzerz5r78o1b.png" alt="Image description" width="800" height="434"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;after create project, you will be given a brief guide to starting sentry&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2ci5hokl75cekx3ykp9w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2ci5hokl75cekx3ykp9w.png" alt="Image description" width="800" height="182"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;install &lt;code&gt;go get github.com/getsentry/sentry-go&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2fktrsexioujohptprt4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2fktrsexioujohptprt4.png" alt="Image description" width="800" height="229"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;import &lt;code&gt;github.com/getsentry/sentry-go&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyl2r6qq6vd9ocjan5plr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyl2r6qq6vd9ocjan5plr.png" alt="Image description" width="800" height="245"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;setup ur dsn &lt;code&gt;Dsn: "https://--DSN--"&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;"you will get dsn when you first create a project",&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdwvuqc52rrfveuaezzgi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdwvuqc52rrfveuaezzgi.png" alt="Image description" width="800" height="219"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;capture message &lt;code&gt;sentry.CaptureMessage("It works!")&lt;/code&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fibq8aurw8pbd6epaqyl0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fibq8aurw8pbd6epaqyl0.png" alt="Image description" width="800" height="150"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0rzpwen3itwt7newxsse.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0rzpwen3itwt7newxsse.png" alt="Image description" width="540" height="170"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;detail documentation &lt;a href="https://docs.sentry.io/platforms/go/" rel="noopener noreferrer"&gt;https://docs.sentry.io/platforms/go/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>watercooler</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Get Public IP Address using Golang and Ipify library</title>
      <dc:creator>Suharxxxx</dc:creator>
      <pubDate>Thu, 22 Dec 2022 04:11:28 +0000</pubDate>
      <link>https://forem.com/suharyadi2112/get-ippublic-using-golang-and-ipify-library-1a4o</link>
      <guid>https://forem.com/suharyadi2112/get-ippublic-using-golang-and-ipify-library-1a4o</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EBst_xmF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qqesrk95d9f2qqqilyj1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EBst_xmF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qqesrk95d9f2qqqilyj1.png" alt="Image description" width="800" height="528"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;go playgrond&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://go.dev/play/p/fSXBVH3O8cC"&gt;https://go.dev/play/p/fSXBVH3O8cC&lt;/a&gt;&lt;/p&gt;

</description>
      <category>go</category>
      <category>beginners</category>
      <category>tutorial</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
