All Projects → 0x20F → Paris

0x20F / Paris

Licence: mpl-2.0
Logger in Rust for pretty colors and text in the terminal. Aiming for a relatively simple API

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Paris

node-perj
A fast, flexible JSON logger.
Stars: ✭ 16 (-90.12%)
Mutual labels:  fast, simple, logger
Server Manager
This repository holds the IntISP Interface. It can be rebuilt to interface with any other hosting panel.
Stars: ✭ 31 (-80.86%)
Mutual labels:  simple, fast
Pino
🌲 super fast, all natural json logger
Stars: ✭ 8,475 (+5131.48%)
Mutual labels:  logger, fast
Signale
Highly configurable logging utility
Stars: ✭ 8,575 (+5193.21%)
Mutual labels:  cli, logger
Try
Dead simple CLI tool to try Python packages - It's never been easier! 📦
Stars: ✭ 588 (+262.96%)
Mutual labels:  simple, fast
React Native Make
A collection of everyday React Native CLI tools
Stars: ✭ 606 (+274.07%)
Mutual labels:  cli, icons
Derrick
🙌 Derrick is a clean minimal and fast theme for a personal blog.
Stars: ✭ 51 (-68.52%)
Mutual labels:  simple, fast
Pixo
Convert SVG icons into React components
Stars: ✭ 371 (+129.01%)
Mutual labels:  cli, icons
Crates Io Cli
Interact with crates.io from the command-line
Stars: ✭ 82 (-49.38%)
Mutual labels:  cli, crates
Borm
【🔥今日热门】🏎️ 更好的ORM库 (Better ORM library that is simple, fast and self-mockable for Go)
Stars: ✭ 102 (-37.04%)
Mutual labels:  simple, fast
Speedtest Linux
Get download/upload speeds via speedtest.net or fast.com from command line using Bash script -- suitable for logs. POSIX OSX Linux
Stars: ✭ 103 (-36.42%)
Mutual labels:  cli, logger
Prettytable Rs
A rust library to print aligned and formatted tables
Stars: ✭ 552 (+240.74%)
Mutual labels:  cli, crates
Wyhash
The FASTEST QUALITY hash function, random number generators (PRNG) and hash map.
Stars: ✭ 410 (+153.09%)
Mutual labels:  simple, fast
Simplog
A simple logger. No dependencies, no special features, just logging.
Stars: ✭ 17 (-89.51%)
Mutual labels:  simple, logger
Onelog
Dead simple, super fast, zero allocation and modular logger for Golang
Stars: ✭ 389 (+140.12%)
Mutual labels:  logger, fast
Fast Xml Parser
Validate XML, Parse XML to JS/JSON and vise versa, or parse XML to Nimn rapidly without C/C++ based libraries and no callback
Stars: ✭ 1,021 (+530.25%)
Mutual labels:  cli, fast
Template
A super-simple way to create new projects based on templates.
Stars: ✭ 120 (-25.93%)
Mutual labels:  cli, simple
Maroto
A maroto way to create PDFs. Maroto is inspired in Bootstrap and uses gofpdf. Fast and simple.
Stars: ✭ 334 (+106.17%)
Mutual labels:  simple, fast
Colorls
A Ruby gem that beautifies the terminal's ls command, with color and font-awesome icons. 🎉
Stars: ✭ 3,896 (+2304.94%)
Mutual labels:  cli, icons
Xa
Beautiful & Customizable logger ❤️
Stars: ✭ 78 (-51.85%)
Mutual labels:  cli, simple

paris

Simple way to output beautiful text in your CLI applications. Only limit is your imagination.

Build status badge Crates io badge Repository version badge License badge

How to use

[dependencies]
paris = "1.5"
use paris::Logger;

let mut log = Logger::new();

log.info("It's that simple!");

Optional features

Timestamps

If you'd like timestamps with all your logs you'll have to enable the feature when adding the crate as a dependency.

Notice: This will also include chrono as a dependency.

[dependencies]
paris = { version = "1.5", features = ["timestamps"] }
Macros

Every common function has a macro. To make use of these macros you'll need to enable the macros feature.

[dependencies]
paris = { version = "1.5", features = ["macros"] }
No logger

If you'd prefer to only use the macros and not even have the Logger struct included in your package, that's definitely possible! All you need to do is enable the no_logger feature.

[dependencies]
paris = { version = "1.5", features = ["no_logger"] }

Simple API

// You can have icons at the start of your message!
log.info("Will add ℹ at the start");
log.error("Will add ✖ at the start");

// or as macros
info!("Will add ℹ at the start");
error!("Will add ✖ at the start");
See the Logger struct for all methods and their macro equivalents

Chaining

All methods can be chained together to build more intricate log/message combinations, in hopes of minimizing the chaos that every log string becomes when you have to concatenate a bunch of strings and add tabs and newlines everywhere.

log.info("this is some info")
   .indent(4).warn("this is now indented by 4")
   .newline(5)
   .success("and this is 5 lines under all other messages");

Customisation

Outputting text is cool. Outputting text with a colored icon at the start is even cooler! But this crate is all about customisation, about making the logs feel like home, if you will. Included in the crate are a variety of keys you can use to colorize your logs just the way you want them to be.

log.info("I can write normal text or use tags to <red>color it</>");
log.warn("Every function can contain <on-green><black>tags</>");

log.info("If you don't write them <bleu>correctly</>, you just get an ugly looking tag");

There's a key for all colors supported by the terminal (white, black, red, blue, magenta, etc.) If you add the word on to any of those colors, it becomes the background color instead (on-red, on-blue, on-green).

// How useful...
log.info("<on-red> This has red background</>");

Maybe you'd like to use your terminals brighter colors, if that's the case you just have to add bright to your tag. Makes sense.

log.info("<blue><on-bright-red> This text is blue on a bright red background</> it's a pain");

If you feel like writing a lot of colors by hand is too tedious, or if you know you're going to be using the same combination of colors over and over again you can create a custom style that encapsulates all those colors.

log.add_style("lol", vec!["green", "bold", "on-bright-blue"]);

// '<lol>' is now a key that you can use in your strings
log.info("<lol>This is has all your new styles</>");
Scroll down for a full list of keys if you're not feeling confident in your ability to name colors. It happens.

Resetting

You've probably seen the </> tag in the above logs. It's not there to "close the previously opened tag" no no. You can open as many tags as you want and only use </> once, it's just the "reset everything to default" tag, You might decide you don't ever want to use it. It's up to you.

However, resetting everything to default might not be what you want. Most of the time it'll be enough, but for those times when it isn't there are a few other tags such as:

  • <///> only resets the background
  • <//> only reset the foreground

Macros

With the macros feature enabled, you get access to macro equivalents of the logger functions.

Advantages of using macros:

  • You don't have to instantiate the logger Logger::new()
  • Simple to write
  • Can format parameters like print! and println!

Disadvantages of using macros:

  • Can't chain calls
  • Manual newlines and tabs with \n and \t
  • There's no loading animation for macros

You get to decide whether you want to use macros or not. Every macro has the same functionality as its Logger equivalent. Colors and icon keys work just the same.

See the Logger struct for all methods and their macro equivalents

Color keys

To use a key just add the color name surrounded by <, > to your log string. If you don't like the dashes(-), you can use underlines(_) or spaces()

Foreground

black, red, green, yellow, blue, cyan, magenta, white

Bright

bright-black, bright-red, bright-green, bright-yellow, bright-blue, bright-cyan, bright-magenta, bright-white

Background

on-black, on-red, on-green, on-yellow, on-blue, on-cyan, on-magenta, on-white

Bright

on-bright-black, on-bright-red, on-bright-green, on-bright-yellow, on-bright-blue, on-bright-cyan, on-bright-magenta, on-bright-white

Styles

bold(b), underline(u), dimmed(d), italic(i)

Styles are a bit different, they all have their usual keys, the long and painful to write ones. But they also have shorthand keys (in parenthesis).

And while they all may reset using one of the reset keys above, if you're looking to turn off a specific style you've opened, you can just use the exact same key but with a slash / in front of it.

Example: <bold> gets closed by </bold>

Icons

info, cross, warn, tick, heart

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].