Skip to content

Commit

Permalink
*: Initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
kkrypt0nn committed Oct 26, 2023
0 parents commit 73d1526
Show file tree
Hide file tree
Showing 19 changed files with 974 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
github: kkrypt0nn
ko_fi: kkrypt0nn
custom: ['https://buymeacoffee.com/kkrypt0nn']
51 changes: 51 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Bug report
description: Create a report to help us improve
title: '[Bug]: '
labels: [ 'bug' ]
body:
- type: textarea
id: description
attributes:
label: Describe the bug
description: A clear and concise description of what the bug is.
validations:
required: true
- type: textarea
id: reproduce
attributes:
label: Reproduction steps
description: Steps to reproduce the behavior
validations:
required: true
- type: textarea
id: expected
attributes:
label: Expected behavior
description: A clear and concise description of what you expected to happen.
validations:
required: true
- type: textarea
id: screenshots
attributes:
label: Screenshots
description: If applicable, add screenshots to help explain your issue.
validations:
required: true
- type: textarea
id: environment
attributes:
label: Environment
description: Fill in the information about the environment you're running the project on.
value: |
- Device: [e.g. Mac M1]
- OS: [e.g. macOS 13.3.1]
- Project Version: [e.g. 1.0.0]
validations:
required: true
- type: textarea
id: context
attributes:
label: Additional context
description: Add any other context about the problem here.
validations:
required: false
47 changes: 47 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: tangra.rs CI (Lint & Test)

on: [ push, pull_request ]

permissions:
contents: read

jobs:
rustfmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Run rustfmt
run: cargo fmt --all -- --check --verbose
clippy:
name: clippy
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Run Clippy
run: cargo clippy --all-targets --all-features
test:
name: Test
runs-on: ${{ matrix.os }}
needs: [ rustfmt, clippy ]
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
toolchain:
- "stable"
- "nightly"
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Install nightly toolchain
if: matrix.toolchain == 'nightly'
run: rustup toolchain install nightly
- name: Build
run: cargo +${{ matrix.toolchain }} build --all --no-default-features --all-features
- name: Test
run: cargo +${{ matrix.toolchain }} test --all --no-default-features --all-features
20 changes: 20 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: tangra.rs CD (Publish)

on:
push:
tags:
- "*"
workflow_dispatch:

permissions:
contents: read

jobs:
test:
name: Publish
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Publish
run: cargo publish --verbose --all-features --token ${{ secrets.CARGO_TOKEN }}
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Cargo
# will have compiled files and executables
debug/
target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

# RustRover files
.idea/
11 changes: 11 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "tangra"
description = "馃 A lightweight and easy to use Rust logging library"
version = "1.3.0"
edition = "2021"
license = "MIT"
readme = "README.md"

[dependencies]
chrono = "0.4.31"
whoami = "1.4.1"
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023-Present Krypton

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
180 changes: 180 additions & 0 deletions PLACEHOLDERS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
# Placeholders

This is the list of placeholders and aliases that will get replaced in your logging messages and prefix.

## Placeholders

### Caller

| Name | Value |
|------------------|-----------------------------------------------|
| `$[caller:file]` | The name of the file where it has been logged |
| `$[caller:line]` | The line in the file where it has been logged |

### Logging Level

| Name | Value |
|----------------------|------------------------------------------------------|
| `$[level:color]` | The color representing the logging level |
| `$[level:lowername]` | The name in lowercase representing the logging level |
| `$[level:name]` | The name representing the logging level |
| `$[level:shortname]` | The short name representing the logging level |

### Date & Time Now

| Name | Value |
|-------------------|-----------------------------------------------------------------|
| `$[now:date]` | The current date, default format is `Jan 02, 2006` |
| `$[now:time]` | The current time, default format is `15:04:05` |
| `$[now:datetime]` | The current datetime, default format is `Jan 02, 2006 15:04:05` |

### System

| Name | Value |
|---------------------------|----------------------------------------|
| `$[sys:architecture]` | The runtime architecture of the system |
| `$[sys:hostname]` | The hostname of the system |
| `$[sys:operating_system]` | The runtime operating system |
| `$[sys:username]` | The username of the system |
| `$[sys:groupid]` | The group ID of the current user |
| `$[sys:userid]` | The user ID of the current user |

### Foreground Colors

| Name | Value |
|----------------------|------------------------------------|
| `$[fg:black]` | The black foreground color |
| `$[fg:red]` | The red foreground color |
| `$[fg:green]` | The green foreground color |
| `$[fg:yellow]` | The yellow foreground color |
| `$[fg:blue]` | The blue foreground color |
| `$[fg:purple]` | The purple foreground color |
| `$[fg:cyan]` | The cyan foreground color |
| `$[fg:white]` | The white foreground color |
| `$[fg:gray]` | The gray foreground color |
| `$[fg:brightred]` | The bright red foreground color |
| `$[fg:brightgreen]` | The bright green foreground color |
| `$[fg:brightyellow]` | The bright yellow foreground color |
| `$[fg:brightblue]` | The bright blue foreground color |
| `$[fg:brightpurple]` | The bright purple foreground color |
| `$[fg:brightcyan]` | The bright cyan foreground color |
| `$[fg:brightwhite]` | The bright white foreground color |

### Background Colors

| Name | Value |
|----------------------|------------------------------------|
| `$[bg:black]` | The black background color |
| `$[bg:red]` | The red background color |
| `$[bg:green]` | The green background color |
| `$[bg:yellow]` | The yellow background color |
| `$[bg:blue]` | The blue background color |
| `$[bg:purple]` | The purple background color |
| `$[bg:cyan]` | The cyan background color |
| `$[bg:white]` | The white background color |
| `$[bg:gray]` | The gray background color |
| `$[bg:brightred]` | The bright red background color |
| `$[bg:brightgreen]` | The bright green background color |
| `$[bg:brightyellow]` | The bright yellow background color |
| `$[bg:brightblue]` | The bright blue background color |
| `$[bg:brightpurple]` | The bright purple background color |
| `$[bg:brightcyan]` | The bright cyan background color |
| `$[bg:brightwhite]` | The bright white background color |

### Special Effects

| Name | Value |
|---------------------------|--------------------------|
| `$[effect:bold]` | The bold effect |
| `$[effect:dim]` | The dim effect |
| `$[effect:underline]` | The underline effect |
| `$[effect:blink]` | The blink effect |
| `$[effect:inverse]` | The inverse effect |
| `$[effect:strikethrough]` | The strikethrough effect |
| `$[effect:reset]` | Resets the styles |

## Aliases

### Caller

| Name | Alias of |
|-----------|------------------|
| `$[file]` | `$[caller:file]` |
| `$[line]` | `$[caller:line]` |

### Date & Time Now

| Name | Alias of |
|---------------|-------------------|
| `$[date]` | `$[now:date]` |
| `$[time]` | `$[now:time]` |
| `$[datetime]` | `$[now:datetime]` |

### System

| Name | Alias of |
|-----------------------|---------------------------|
| `$[sys:arch]` | `$[sys:architecture]` |
| `$[architecture]` | `$[sys:architecture]` |
| `$[arch]` | `$[sys:architecture]` |
| `$[sys:os]` | `$[sys:operating_system]` |
| `$[operating_system]` | `$[sys:operating_system]` |
| `$[os]` | `$[sys:operating_system]` |
| `$[hostname]` | `$[sys:hostname]` |
| `$[username]` | `$[sys:username]` |
| `$[groupid]` | `$[sys:groupid]` |
| `$[userid]` | `$[sys:userid]` |

### Foreground Colors

| Name | Alias of |
|-------------------|----------------------|
| `$[black]` | `$[fg:black]` |
| `$[red]` | `$[fg:red]` |
| `$[green]` | `$[fg:green]` |
| `$[yellow]` | `$[fg:yellow]` |
| `$[blue]` | `$[fg:blue]` |
| `$[purple]` | `$[fg:purple]` |
| `$[cyan]` | `$[fg:cyan]` |
| `$[white]` | `$[fg:white]` |
| `$[gray]` | `$[fg:gray]` |
| `$[brightred]` | `$[fg:brightred]` |
| `$[brightgreen]` | `$[fg:brightgreen]` |
| `$[brightyellow]` | `$[fg:brightyellow]` |
| `$[brightblue]` | `$[fg:brightblue]` |
| `$[brightpurple]` | `$[fg:brightpurple]` |
| `$[brightcyan]` | `$[fg:brightcyan]` |
| `$[brightwhite]` | `$[fg:brightwhite]` |

### Background Colors

| Name | Alias of |
|--------------------|----------------------|
| `$[bblack]` | `$[bg:black]` |
| `$[bred]` | `$[bg:red]` |
| `$[bgreen]` | `$[bg:green]` |
| `$[byellow]` | `$[bg:yellow]` |
| `$[bblue]` | `$[bg:blue]` |
| `$[bpurple]` | `$[bg:purple]` |
| `$[bcyan]` | `$[bg:cyan]` |
| `$[bwhite]` | `$[bg:white]` |
| `$[bgray]` | `$[bg:gray]` |
| `$[bbrightred]` | `$[bg:brightred]` |
| `$[bbrightgreen]` | `$[bg:brightgreen]` |
| `$[bbrightyellow]` | `$[bg:brightyellow]` |
| `$[bbrightblue]` | `$[bg:brightblue]` |
| `$[bbrightpurple]` | `$[bg:brightpurple]` |
| `$[bbrightcyan]` | `$[bg:brightcyan]` |
| `$[bbrightwhite]` | `$[bg:brightwhite]` |

### Special Effects

| Name | Alias of |
|--------------------|---------------------------|
| `$[bold]` | `$[effect:bold]` |
| `$[dim]` | `$[effect:dim]` |
| `$[underline]` | `$[effect:underline]` |
| `$[blink]` | `$[effect:blink]` |
| `$[inverse]` | `$[effect:inverse]` |
| `$[strikethrough]` | `$[effect:strikethrough]` |
| `$[reset]` | `$[effect:reset]` |
Loading

0 comments on commit 73d1526

Please sign in to comment.