<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: 吴敬</title>
    <description>The latest articles on DEV Community by 吴敬 (@wujingyue).</description>
    <link>https://dev.to/wujingyue</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%2F2263299%2Fc8e5e845-0032-47e8-8388-0614daf7135c.png</url>
      <title>DEV Community: 吴敬</title>
      <link>https://dev.to/wujingyue</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/wujingyue"/>
    <language>en</language>
    <item>
      <title>Convenient tools for viewing logs of React Native release builds</title>
      <dc:creator>吴敬</dc:creator>
      <pubDate>Thu, 24 Oct 2024 06:25:40 +0000</pubDate>
      <link>https://dev.to/wujingyue/convenient-tools-for-viewing-logs-of-react-native-release-builds-34jl</link>
      <guid>https://dev.to/wujingyue/convenient-tools-for-viewing-logs-of-react-native-release-builds-34jl</guid>
      <description>&lt;p&gt;原文链接：&lt;a href="https://github.com/wutiange/log-record" rel="noopener noreferrer"&gt;https://github.com/wutiange/log-record&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Introduction
&lt;/h2&gt;

&lt;p&gt;A system for viewing logs in the release environment. Why does this system exist? It’s because I found that when testers encountered problems during testing, they didn’t know who was responsible; they always recorded bugs under my name. Additionally, some bugs were intermittent, appearing once and then disappearing the next time. With logs, testers don’t need to reproduce the issue, and I can directly check the logs to find the problem. However, the logs might not be comprehensive enough, so it’s important to log as much as possible when writing code to facilitate troubleshooting.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Integration
&lt;/h2&gt;

&lt;p&gt;Before using the Log Record system, you first need to integrate log-listener-plugin into your project. Please refer to the corresponding documentation for specific integration instructions.&lt;/p&gt;

&lt;p&gt;This project only supports react-native projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Usage
&lt;/h2&gt;

&lt;p&gt;I’ll use macOS as an example. First, visit this website to download the corresponding version of the software. Try to download the latest version, as it has fixed many previous bugs:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/wutiange/log-record/releases" rel="noopener noreferrer"&gt;https://github.com/wutiange/log-record/releases&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%2Fmiro.medium.com%2Fv2%2Fresize%3Afit%3A1400%2Fformat%3Awebp%2F0%2AcEV5i-XaANDyk3M-.jpg" 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%2Fmiro.medium.com%2Fv2%2Fresize%3Afit%3A1400%2Fformat%3Awebp%2F0%2AcEV5i-XaANDyk3M-.jpg" alt="package" width="800" height="479"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once there, download the latest version. After downloading, unzip it:&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%2Fmiro.medium.com%2Fv2%2Fresize%3Afit%3A1400%2Fformat%3Awebp%2F0%2AluAUXkH_Osrj5yTa" 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%2Fmiro.medium.com%2Fv2%2Fresize%3Afit%3A1400%2Fformat%3Awebp%2F0%2AluAUXkH_Osrj5yTa" alt="download" width="800" height="378"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Double-click to open the Log Record system. However, you might usually see this prompt:&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%2Fmiro.medium.com%2Fv2%2Fresize%3Afit%3A1040%2Fformat%3Awebp%2F0%2Aw1wF_5ErCFiygwos" 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%2Fmiro.medium.com%2Fv2%2Fresize%3Afit%3A1040%2Fformat%3Awebp%2F0%2Aw1wF_5ErCFiygwos" alt="Safety Tips" width="520" height="524"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Don’t panic at this point. Open “Settings”, then open “Privacy &amp;amp; Security”:&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%2Fmiro.medium.com%2Fv2%2Fresize%3Afit%3A1400%2Fformat%3Awebp%2F0%2Alo2tdSzYoVbpkivo" 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%2Fmiro.medium.com%2Fv2%2Fresize%3Afit%3A1400%2Fformat%3Awebp%2F0%2Alo2tdSzYoVbpkivo" alt="Methods to Address Security Alerts" width="800" height="784"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then click “Open” in the popup dialog to complete the process. After this, logs will be displayed here as they are reported. To ensure proper display, note a few points: if you’re opening this system on your computer, make sure your phone’s WiFi is on the same network as your computer; and that you’ve successfully set the log reporting testUrl in your App. After opening, it looks like this:&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%2Fmiro.medium.com%2Fv2%2Fresize%3Afit%3A1400%2Fformat%3Awebp%2F0%2AFPUzyTZeqkGj3wL2" 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%2Fmiro.medium.com%2Fv2%2Fresize%3Afit%3A1400%2Fformat%3Awebp%2F0%2AFPUzyTZeqkGj3wL2" alt="Software Appearance" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If there are logs at this time, it will look like this:&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%2Fmiro.medium.com%2Fv2%2Fresize%3Afit%3A1400%2Fformat%3Awebp%2F0%2A-F1PUuimA4HAWJfX.jpg" 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%2Fmiro.medium.com%2Fv2%2Fresize%3Afit%3A1400%2Fformat%3Awebp%2F0%2A-F1PUuimA4HAWJfX.jpg" alt="Data Representation" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Each log entry has a horizontal bar next to it, representing the log level, which are the three log types log, warn, and error, as shown in the image:&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%2Fmiro.medium.com%2Fv2%2Fresize%3Afit%3A1400%2Fformat%3Awebp%2F0%2AGfK6lf5MhKI2Y7LD.jpg" 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%2Fmiro.medium.com%2Fv2%2Fresize%3Afit%3A1400%2Fformat%3Awebp%2F0%2AGfK6lf5MhKI2Y7LD.jpg" alt="Log Display Instructions" width="800" height="330"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The second part is the time, which shows when the log was printed.&lt;/p&gt;

&lt;p&gt;There are two buttons in the bottom right corner. The first one clears the current screen logs, and the second button maintains scrolling, which means it will scroll as logs increase.&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%2Fmiro.medium.com%2Fv2%2Fresize%3Afit%3A1400%2Fformat%3Awebp%2F0%2AeABisFho0FfR5v4w" 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%2Fmiro.medium.com%2Fv2%2Fresize%3Afit%3A1400%2Fformat%3Awebp%2F0%2AeABisFho0FfR5v4w" alt="Log Display Instructions" width="800" height="389"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One of the great features is search, which supports simultaneous search, meaning it uses AND logic. For example, if I want to search for logs containing “App”:&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%2Fmiro.medium.com%2Fv2%2Fresize%3Afit%3A1224%2Fformat%3Awebp%2F0%2AaDZhioKgxTA4xfrv.jpg" 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%2Fmiro.medium.com%2Fv2%2Fresize%3Afit%3A1224%2Fformat%3Awebp%2F0%2AaDZhioKgxTA4xfrv.jpg" alt="Log Display Instructions" width="612" height="149"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I find there are still many logs, so I want to add “background” to the logs based on “status”. Just use a space to separate the two pieces of text to perform a simultaneous search:&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%2Fmiro.medium.com%2Fv2%2Fresize%3Afit%3A1240%2Fformat%3Awebp%2F0%2AMSEtKkz1GhyzKXOs.jpg" 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%2Fmiro.medium.com%2Fv2%2Fresize%3Afit%3A1240%2Fformat%3Awebp%2F0%2AMSEtKkz1GhyzKXOs.jpg" alt="Log Display Instructions" width="620" height="105"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I wrote this because I sometimes have such needs in my daily development. In addition to this feature, the search can also filter error levels, phone models, and so on. Whatever types you pass in when you setBaseUrl, you can filter based on those. Below, I’ll demonstrate filtering by log level.&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%2Fmiro.medium.com%2Fv2%2Fresize%3Afit%3A1400%2Fformat%3Awebp%2F0%2ATIZ_7Vbu8WruQhFF.jpg" 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%2Fmiro.medium.com%2Fv2%2Fresize%3Afit%3A1400%2Fformat%3Awebp%2F0%2ATIZ_7Vbu8WruQhFF.jpg" alt="Log Display Instructions" width="773" height="195"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, level represents the reported field name, and warn represents the corresponding value of the field. This format is fixed, and spaces cannot appear in between; spaces are treated as AND relationships.&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>logger</category>
      <category>vue</category>
      <category>typescript</category>
    </item>
  </channel>
</rss>
