Menu Close

[Golang] Ghi log với sirupsen/logrusgger

Thư viện

Ví dụ sử dụng

package main

import (
    log ""

func main() {
        "anima": "walrus",
        "size":   10,
    }).Info("A group of walrus emerges from the ocean")

        "omg":    true,
        "number": 122,
    }).Warn("The groups number increased tremendously")

        "omg":    true,
        "number": 100,
    }).Fatal("The ice breaks!")

Minh họa kết quả

INFO[0000] A group of walrus emerges from the ocean      animal=walrus size=10
WARN[0000] The group's number increased tremendously!    number=122 omg=true
FATA[0000] The ice breaks!                               number=100 omg=true

Leave a Reply

Your email address will not be published. Required fields are marked *