Skip to content

About

Noa json format file written to the encoder

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

8 Commits

Folders and files

Repository files navigation

Noa Encoder Json

JSON encoder for Noa Log. Supports encoding Log entries into JSON format for writing into log files.

Installation

go get -u github.com/noa-log/noa-encoder-json

Quick Start

package main

import (
    "errors"
    "github.com/noa-log/noa"
    noaencoderjson "github.com/noa-log/noa-encoder-json"
)

func main() {
    // Create a new logger instance
    logger := noa.NewLog()
    // Set the encoder to the JSON encoder
    logger.SetEncoder(noaencoderjson.NewJSONEncoder(logger))

    // You can also set different encoders for print and write
    // logger.Encoder.Print = noa.NewTextEncoder(logger)
    // logger.Encoder.Write = noaencoderjson.NewJSONEncoder(logger)

    // Print Log
    logger.Info("Test", "This is an info message")
    logger.Error("Test", errors.New("an example error"))
}

License

This project is open-sourced under the Apache License 2.0. Please comply with the terms when using it.

About

Noa json format file written to the encoder

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages