There are multiple different types of logging including system logs, server logs, garbage collector logs, and application logs.
An application log is a file that contains information about events that have occurred within a software application. Every application produces logs which hold information about what the application is doing.
What type of information is included in a log? It varies by the application. The developers of the software application control what goes into the log file, but there are some commonly included components:
context info: Background information that provides insight into the state of the application at the time of the message
timestamps: A specific piece of contextual information for tracking and correlating issues
Log levels: Labels that help you calculate the level of importance for the entries in your log file. Frequently used levels include INFO, WARN, and ERROR
Why are logs important?
The main use for logs is diagnostics. Logs hold information that can help with
Logging Agent vs Logging Library
A logging agent is a separate service that reads logs from one location and sends them to another location. Think of it like a funnel.
Some benefits of logging agents include:
minimal setup & config
multi-threading & failure safety
scalable (single agent instance can log for almost any number of applications)
modify/update/replace agents w/o having to take down application
Some drawbacks of logging agents include:
require interaction w/ host (not good w/ Serverless)
requires CPU compute usage to track log files
A logging library (or logging framework) is code that you embed into your application to create and manage log events.
Some benefits of logging libraries include:
Some drawbacks of logging libraries include:
usually synchronous (application must wait for the library to finish writing a log event before continuing)
no failure safety (libraries only run as long as your application is running)
not scalable (each application runs its own instance of the library)
Create a new Heroku app by either clicking “Create a new app” in the center of the screen or “New” at the top right of the screen.
Choose an App Name and the Region (either the US or Europe) for your new app. The name can be anything you want. Then, just click the Create app button.
Step 3: Add a PostgreSQL Database
To attach a PostgreSQL database to the blank app you just made, you need to go to the Resources tab in the header of the new app’s dahsboard. Then type Heroku Postgres into the Add-ons search field. When shown, select the suggested Heroku Postgres add-on from the dropdown:
The next popup asks you to choose a pricing plan for the database. Select the Hobby Dev – Free plan and click Provision.
Now your PostgreSQL database is up !
Step 4: Get Heroku DB Information
To find the credentials and the connection URL for the PostgreSQL database, make sure you’re still in the Resources tab and click on the Heroku Postgres resource we just added.
That should bring you to this screen:
Select the Settings tab in the header of that screen. You will be navigated to a page where Here, you can click the View Credentials button to see the credentials of your PostgreSQL database.
You will need these values to input into your PgAdmin interface
Step 5: Configure PgAdmin w/ Heroku DB Credentials
Open up PgAdmin
Right-click on Servers at the very top of the left-side panel
Choose Create > Serve
Fill out the new server form with all of the corresponding information from the Heroku View Credentials page.
After you save the new server, it will become populated with a huge list of databases. You will not have access to any of them except the one with your Database name from Heroku. Scroll through and find this one.
Then, as you would with any other PgAdmin database, go to Schemas > public > Create new Table. Populate this table with the fields you want.
On the far-right side of your Visual Studio workspace, you may have a small file preview panel that shows a faint outline of the entire file that you’re currently in.
This little panel is called the minimap. Visual Studio Code’s definition of the minimap is as follows:
“A Minimap (code outline) gives you a high-level overview of your source code, which is useful for quick navigation and code understanding. A file’s minimap is shown on the right side of the editor. You can click or drag the shaded area to quickly jump to different sections of your file.”
The minimap can be annoying in some circumstances; for example, by limiting the length of your coding window.
How to Toggle the Minimap
Go to View > Command Palette (Ctrl + Shift + P on Windows, Cmd + Shift + P on Mac)
Press on ‘View: Toggle Minimap’ to toggle it on and off
It is used for authorization, not authentication. Authentication is checking if a username and password are correct then logging a user in. Authorization is making sure that the user that is sending requests to your server is the same user that actually logged in during the authentication process.
The basic idea of JWT is a simple way for securely transmitting information between parties as a JSON object
What is the JSON Web Token structure?
A JWT is basically just a bunch of random characters. The token is separated into 3 sections: Header, Payload, and Signature. These sections are separated by dots (.) The structure looks like the following:
The JWT website (https://jwt.io) offers a great breakdown of an actual token:
The header typically consists of two parts: the type of the token, which is JWT, and the signing algorithm being used. Here’s an example:
Then, this JSON is Base64Url encoded to form the first part of the JWT.
The payload is the data that you want to send within the token. In the example, the data being sent is a variable called name with a value of John Doe.
Sometimes it will make sense to have components within components. Or components within components within components. Over time, if you accumulate a lot of properties and components, it can be hard to keep track of everything. React DevTools can help with that.