Skip to content
This repository has been archived by the owner on Aug 15, 2023. It is now read-only.

Commit

Permalink
Merge pull request #70 from iamando/develop
Browse files Browse the repository at this point in the history
feature: update readme doc
  • Loading branch information
ando authored May 1, 2023
2 parents abccf38 + fa34bbf commit a9efe03
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,37 @@ A simple and colorful logging module for Go. It allows developers to easily log

## Install

To install the module, run the following command:

```bash
go get github.com/iamando/welog
```

## Usage

To use the module in your Go program, import it using the following code:

```go
import "github.com/iamando/welog"
```

Then, create a logger using the GenerateLogger function:

```go
logger := welog.GenerateLogger()
```

The **GenerateLogger** function takes a **LogLevel** parameter, which specifies the minimum log level to output. For example, if you set the log level to **Info**, the logger will output all log messages at the **Info**, **Warn**, and **Error** levels.

Once you have a logger, you can use its methods to log messages at different levels:

```go
logger.Debug("Debug message")
logger.Info("Info message")
logger.Warn("Warn message")
logger.Error("Error message")
```

## Example

```go
Expand All @@ -28,7 +49,7 @@ import "github.com/iamando/welog"


func main() {
logger := welog.GenerateLogger(welog.Info, welog.Basic, false)
logger := welog.GenerateLogger()

// log some messages
logger.Error("An error occurred")
Expand Down

0 comments on commit a9efe03

Please sign in to comment.