Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

🪵 A lightweight and easy to use Go logging library

License

NotificationsYou must be signed in to change notification settings

kkrypt0nn/tangra

Repository files navigation

Go ReferenceRepository LicenseCode SizeLast Commit

A lightweight and easy to use Go logging library that includes logging functionalities with different levels and customformatting. It can also be used as a library to simply format the various messages you print in the terminal.

Showcase

macOS

macOS Showcase

Linux

Linux Showcase

Windows

Windows Showcase

Installation

If you want to use this library for one of your projects, you can install it like any other Go library

go get github.com/kkrypt0nn/tangra

Customizing

Prefix

The prefix, what comes before the message, can be changed with theSetPrefix method on aLogger structure.

The default prefix is${datetime} ${level:color}${level:name}${reset}:

Placeholders

There are formatting placeholders that will be replaced in both the message and the prefix that can beseenhere. All the placeholders in effect can be seen intheplaceholders example.

For example, logging the following message

${fg:red}${effect:blink}${effect:bold}${sys:username} says hello!

Will print a red blinking message in bold that says<username> says hello!, where<username> is the username on yoursystem.

Styling

You can choose whether you want to style your messages or not with theSetStyling method on aLogger structure.Styling includes foreground colors, background colors and special effects such as bold, and others - seetheterminal package.

Note: The styling willnot apply to the message if it is not supported by the terminal.

Log File

Logs can also be written inside a log file with styling removed. See theexample here.

License

This library was made with 💜 by Krypton and is under theMIT license.


[8]ページ先頭

©2009-2025 Movatter.jp