{"id":15629763,"url":"https://github.com/0x20f/paris","last_synced_at":"2025-04-12T20:42:05.293Z","repository":{"id":40540090,"uuid":"225930023","full_name":"0x20F/paris","owner":"0x20F","description":"Logger and ANSI formatter in Rust for pretty colors and text in the terminal with no dependencies. Aiming for a relatively simple API","archived":false,"fork":false,"pushed_at":"2023-03-30T05:33:19.000Z","size":5215,"stargazers_count":271,"open_issues_count":2,"forks_count":11,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-04T00:08:37.591Z","etag":null,"topics":["ansi","cli","crates","customisation","formatter","icons","logger","no-dependencies","rust","rust-lang","simple-api","terminal-colors","terminal-icons"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/0x20F.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-04T18:19:21.000Z","updated_at":"2025-03-24T06:00:11.000Z","dependencies_parsed_at":"2024-06-19T04:09:21.253Z","dependency_job_id":"38c4929a-5860-41e0-a10e-2ace1c834f63","html_url":"https://github.com/0x20F/paris","commit_stats":{"total_commits":341,"total_committers":8,"mean_commits":42.625,"dds":0.281524926686217,"last_synced_commit":"c56e40407db15563531499eb980231a803c45e1b"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x20F%2Fparis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x20F%2Fparis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x20F%2Fparis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x20F%2Fparis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0x20F","download_url":"https://codeload.github.com/0x20F/paris/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248631668,"owners_count":21136554,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansi","cli","crates","customisation","formatter","icons","logger","no-dependencies","rust","rust-lang","simple-api","terminal-colors","terminal-icons"],"created_at":"2024-10-03T10:28:36.940Z","updated_at":"2025-04-12T20:42:05.263Z","avatar_url":"https://github.com/0x20F.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eparis\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003eSimple way to output beautiful text in your CLI applications. Only limit is your imagination.\u003c/p\u003e\n\n\n\u003cp align=\"center\"\u003e\n   \u003cimg alt=\"Build status badge\" src=\"https://github.com/0x20F/paris/workflows/build/badge.svg\"/\u003e\n   \u003cimg alt=\"Crates io badge\" src=\"https://img.shields.io/crates/v/paris.svg\"/\u003e\n   \u003cimg alt=\"Repository version badge\" src=\"https://img.shields.io/badge/master-v1.5.14-blue.svg\"\u003e\n   \u003ca href=\"https://opensource.org/licenses/MPL-2.0\"\u003e\u003cimg alt=\"License badge\" src=\"https://img.shields.io/badge/License-MPL%202.0-brightgreen.svg\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\n\u003cp align=\"center\"\u003e\n   \u003cimg src=\"https://github.com/0x20F/paris/blob/master/example/paris_example.gif?raw=true\"/\u003e\n\u003c/p\u003e\n\n\u003cbr/\u003e\n\u003cbr/\u003e\n\n\u003ch2 align=\"center\"\u003eNotice\u003c/h2\u003e\n\nIf the provided _logging_ API is too simple for your use case (it's definitely not meant for anything too complex) but you still like the formatting style (`\u003cblue\u003e\u003c/\u003e` etc) then you can still make use of this crate! See [here](https://github.com/0x20F/paris/issues/38#issuecomment-950874653) for a quick example.\n\nBy importing the `format` module, you get access to the `Formatter` structure itself. This is what the `Logger` uses in the back end anyway, you're basically stripping away the API.\n\nFor even more ease of use the `formatter` module includes a `colorize_string` function which you can use to directly colorize whatever without initializing the formatter. Drawbacks and caveats may apply, read the docs.\n\n###### See [the formatter module](https://docs.rs/paris/1.5.7/paris/formatter/index.html) for more info if needed.\n \n\n\u003cbr/\u003e\n\n## How to use\n```toml\n[dependencies]\nparis = \"1.5\"\n```\n\n```rust\nuse paris::Logger;\n\nlet mut log = Logger::new();\n\nlog.info(\"It's that simple!\");\n```\n\n#### Optional features\n\n##### Timestamps \nIf you'd like timestamps with all your logs you'll\nhave to enable the feature when adding the crate as a dependency. \n```toml\n[dependencies]\nparis = { version = \"1.5\", features = [\"timestamps\"] }\n```\n\n##### Macros\nEvery common function has a macro. To make use of these\nmacros you'll need to enable the macros feature.\n```toml\n[dependencies]\nparis = { version = \"1.5\", features = [\"macros\"] }\n```\n\n##### No logger\nIf you'd prefer to only use the macros and not even have\nthe `Logger` struct included in your package, that's definitely possible!\nAll you need to do is enable the `no_logger` feature.\n```toml\n[dependencies]\nparis = { version = \"1.5\", features = [\"no_logger\"] }\n```\n\n\n### Simple API\n```rust\n// You can have icons at the start of your message!\nlog.info(\"Will add ℹ at the start\");\nlog.error(\"Will add ✖ at the start\");\n\n// or as macros\ninfo!(\"Will add ℹ at the start\");\nerror!(\"Will add ✖ at the start\");\n```\n###### See [the Logger struct](https://docs.rs/paris/) for all methods and their macro equivalents\n\n\n### Chaining\nAll methods can be chained together to build more intricate\nlog/message combinations, in hopes of minimizing the chaos\nthat every log string becomes when you have to concatenate\na bunch of strings and add tabs and newlines everywhere.\n```rust\nlog.info(\"this is some info\")\n   .indent(4).warn(\"this is now indented by 4\")\n   .newline(5)\n   .success(\"and this is 5 lines under all other messages\");\n```\n\n\n### Customisation\nOutputting text is cool. Outputting text with a colored icon\nat the start is even cooler! But this crate is all about\ncustomisation, about making the logs feel like home, if you will.\nIncluded in the crate are a variety of keys you can use\nto colorize your logs just the way you want them to be.\n```rust\nlog.info(\"I can write normal text or use tags to \u003cred\u003ecolor it\u003c/\u003e\");\nlog.warn(\"Every function can contain \u003con-green\u003e\u003cblack\u003etags\u003c/\u003e\");\n\nlog.info(\"If you don't write them \u003cbleu\u003ecorrectly\u003c/\u003e, you just get an ugly looking tag\");\n```\n\nThere's a key for all colors supported by the terminal `(white, black, red, blue, magenta, etc.)`\nIf you add the word `on` to any of those colors, it becomes the\nbackground color instead `(on-red, on-blue, on-green)`.\n```rust\n// How useful...\nlog.info(\"\u003con-red\u003e This has red background\u003c/\u003e\");\n```\n\nMaybe you'd like to use your terminals brighter colors, if that's the case\nyou just have to add `bright` to your tag. Makes sense.\n```rust\nlog.info(\"\u003cblue\u003e\u003con-bright-red\u003e This text is blue on a bright red background\u003c/\u003e it's a pain\");\n```\n\nIf you feel like writing a lot of colors by hand is too tedious, or if you know you're going\nto be using the same combination of colors over and over again you can create a `custom style`\nthat encapsulates all those colors.\n```rust\nlog.add_style(\"lol\", vec![\"green\", \"bold\", \"on-bright-blue\"]);\n\n// '\u003clol\u003e' is now a key that you can use in your strings\nlog.info(\"\u003clol\u003eThis is has all your new styles\u003c/\u003e\");\n```\n\n###### Scroll down for a full list of keys if you're not feeling confident in your ability to name colors. It happens.\n\n\n### Resetting\nYou've probably seen the `\u003c/\u003e` tag in the above logs. It's not there to\n_\"close the previously opened tag\"_ no no. You can open as many tags as you want\nand only use `\u003c/\u003e` once, it's just the _\"reset everything to default\"_ tag, You might\ndecide you don't ever want to use it. It's up to you.\n\nHowever, resetting everything to default might not be what you want. Most of the time\nit'll be enough, but for those times when it isn't there are a few other tags such as:\n\n* `\u003c///\u003e` only resets the background\n* `\u003c//\u003e` only reset the foreground\n\n\n### Macros\nWith the macros feature enabled, you get access to macro equivalents\nof the logger functions.\n\nAdvantages of using macros:\n* You don't have to instantiate the logger `Logger::new()`\n* Simple to write\n* Can format parameters like `print!` and `println!`\n\nDisadvantages of using macros:\n* Can't chain calls\n* Manual newlines and tabs with `\\n` and `\\t`\n* There's no loading animation for macros\n\nYou get to decide whether you want to use macros or not.\nEvery macro has the same functionality as its `Logger`\nequivalent. Colors and icon keys work just the same.\n###### See [the Logger struct](https://docs.rs/paris/) for all methods and their macro equivalents\n\n\n## Color keys\nTo use a key just add the color name surrounded by `\u003c`, `\u003e` to your log string. If you don't like the dashes(`-`),\nyou can use underlines(`_`) or spaces(` `)\n\n#### Foreground\n`black`, `red`, `green`, `yellow`, `blue`, `cyan`, `magenta`, `white`\n\n##### Bright\n`bright-black`, `bright-red`, `bright-green`, `bright-yellow`, `bright-blue`, `bright-cyan`, `bright-magenta`,\n `bright-white`\n\n\n#### Background\n`on-black`, `on-red`, `on-green`, `on-yellow`, `on-blue`, `on-cyan`, `on-magenta`, `on-white`\n\n##### Bright\n`on-bright-black`, `on-bright-red`, `on-bright-green`, `on-bright-yellow`, `on-bright-blue`, `on-bright-cyan`, \n`on-bright-magenta`, `on-bright-white`\n\n#### Styles\n`bold`(`b`), `underline`(`u`), `dimmed`(`d`), `italic`(`i`), `blink`(`l`), `reverse`(`r`), `hidden`(`h`), `strikethrough`(`s`)\n\nStyles are a bit different, they all have their usual keys, the long and painful to write ones. But they \nalso have shorthand keys (in parenthesis).\n\nAnd while they all may reset using one of the reset keys above, if you're looking to turn off a specific\nstyle you've opened, you can just use the exact same key but with a slash `/` in front of it.\n\nExample: `\u003cbold\u003e` gets closed by `\u003c/bold\u003e` \n\n#### Icons\n`info`, `cross`, `warn`, `tick`, `heart`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0x20f%2Fparis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0x20f%2Fparis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0x20f%2Fparis/lists"}