Post probably

main
able 2023-11-18 01:22:21 -06:00
parent 81b1be8195
commit 11b5ad158a
2 changed files with 75 additions and 7 deletions

View File

@ -0,0 +1,70 @@
You might have noticed the language used in my blog post is not any other existing language.
It is what is called an IDL or Interface Definition Language.
Typically IDLs are used to define interchange formats for programs, like I use it for.
These languages are used to define how data is laid out in byte format.
In this post I will be explaining and defining a log format.
Typical logging systems have multiple severities of logs.
The [log](https://docs.rs/log/latest/log) crate for rust operates using five different log levels
```
Error
Warn
Info
Debug
Trace
```
The [winston](https://www.npmjs.com/package/winston) library for javascript uses the following levels.
```
error
warn
info
http
verbose
debug
silly
```
There is also [this](https://datatracker.ietf.org/doc/html/rfc5424) RFC which I won't read
I am partial to the `log` method so let us adopt that format for log levels.
We should also assign a numerical value to each log level starting with the most important to the least important.
```rust
enum LogLevel {
Error = 0,
Warn = 1,
Info = 2,
Debug = 3,
Trace = 4,
}
```
Thats a bit much and adding a new level is not an automatic increment thing.
Lets introduce a new concept to the language called an attribute.
```rust
@auto_increment
enum LogLevel {
Error = 0,
Warn,
Info,
Debug,
Trace,
}
```
The `auto_increment` attribute finds all enum variants with a number and increments by one whole number until it finds an already assigned number or there are no more variants.
This reduces the chance of messing up aswell as makes you just type less.
Syntax sugar and all that.

View File

@ -2,13 +2,11 @@
ˈbaɪbəl
## In order
[Unix and mice](Unix;%20Your%20Mouse%20are%20a%20file.md)
## In order
[Unix and mice](Unix;%20Your%20Mouse%20are%20a%20file.md)
[Files???](Files;%20an%20overview.md)
[Files???](Files;%20an%20overview.md)
[Driver Dependencies](Catch-22;%20an%20overview.md)
[Driver Dependencies](Catch-22;%20an%20overview.md)
[Storing Hell in my heart](ATA,%20NVMe,%20SATA,%20Floppy%20Disks%20and%20Optical%20Drives;%20Storing%20my%20own%20personal%20hell.md)
[Storing Hell in my heart](ATA,%20NVMe,%20SATA,%20Floppy%20Disks%20and%20Optical%20Drives;%20Storing%20my%20own%20personal%20hell.md)