Skip to content

Commit

Permalink
release v0.1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
kataras committed Oct 29, 2022
1 parent 350ad62 commit cab8303
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 94 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

strategy:
matrix:
go_version: [1.18.x]
go_version: [1.19.x]
steps:

- name: Set up Go 1.x
Expand Down
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Sat 29 October 2022 | v0.1.8

Add `golog.Now` variable so 3rd-parties can customize the time.Now functionality used in golog.Log.Time and Timestamp.

## Wed 09 Decemember | v0.1.6

Fix `Clone` not inherite the parent's formatters field (fixes `SetLevelFormat` on childs).
Expand Down
46 changes: 23 additions & 23 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
Copyright (c) 2017-2022 Gerasimos Maropoulos.
BSD 3-Clause License

Copyright (c) 2017-2022, Gerasimos (Makis) Maropoulos ([email protected])
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of golog nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# ✒️ golog

_golog_ is a zero-dependency simple, fast and easy-to-use level-based logger written in [Go Programming Language](https://golang.org/dl).
_golog_ is a zero-dependency simple, fast and easy-to-use level-based logger written in [Go Programming Language](https://go.dev).

![Output from win terminal](screen.png)

[![build status](https://img.shields.io/github/workflow/status/kataras/golog/CI/master)](https://github.com/kataras/golog/actions) [![report card](https://img.shields.io/badge/report%20card-a%2B-ff3333.svg?style=flat-square)](http://goreportcard.com/report/kataras/golog) [![godocs](https://img.shields.io/badge/online-documentation-0366d6.svg?style=flat-square)](https://godoc.org/github.com/kataras/golog) [![github issues](https://img.shields.io/github/issues/kataras/golog.svg?style=flat-square)](https://github.com/kataras/golog/issues?q=is%3Aopen+is%3Aissue)
[![build status](https://img.shields.io/github/workflow/status/kataras/golog/CI/master)](https://github.com/kataras/golog/actions) [![report card](https://img.shields.io/badge/report%20card-a%2B-ff3333.svg?style=flat-square)](http://goreportcard.com/report/kataras/golog) [![godocs](https://img.shields.io/badge/online-documentation-0366d6.svg?style=flat-square)](https://pkg.go.dev/github.com/kataras/golog) [![github issues](https://img.shields.io/github/issues/kataras/golog.svg?style=flat-square)](https://github.com/kataras/golog/issues?q=is%3Aopen+is%3Aissue)

<!-- ## 🥇 Features
Expand All @@ -23,7 +23,7 @@ Navigate through [_examples](_examples/) and [integrations](_examples/integratio

## 🚀 Installation

The only requirement is the Go Programming Language[*](https://golang.org).
The only requirement is the Go Programming Language[*](https://go.dev/dl).

<details>
<summary>Go modules</summary>
Expand All @@ -34,13 +34,13 @@ $ go get github.com/kataras/golog@latest

Or edit your project's go.mod file and execute $ go build.

```bash
```mod
module your_project_name
go 1.15
go 1.19
require (
github.com/kataras/golog v0.1.4
github.com/kataras/golog v0.1.8
)
```

Expand All @@ -49,7 +49,7 @@ require (
</details>

```bash
$ go get -u github.com/kataras/golog
$ go get github.com/kataras/golog@latest
```

```go
Expand Down
98 changes: 40 additions & 58 deletions doc.go
Original file line number Diff line number Diff line change
@@ -1,53 +1,52 @@
/*
Copyright (c) 2017-2021 Gerasimos Maropoulos.
CBSD 3-Clause License
Copyright (c) 2017-2022, Gerasimos (Makis) Maropoulos ([email protected])
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of golog nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/*
Package golog provides an easy to use foundation for your logging operations.
Source code and other details for the project are available at GitHub:
https://github.com/kataras/golog
https://github.com/kataras/golog
Current Version
# Current Version
0.1.7
0.1.8
Installation
# Installation
The only requirement is the Go Programming Language
$ go get -u github.com/kataras/golog
Overview
$ go get github.com/kataras/golog@latest
# Overview
Example code:
Expand Down Expand Up @@ -77,10 +76,7 @@ Example code:
golog.Debug("This is a debug message")
}
New
# New
Golog has a default, package-level initialized instance for you,
however you can choose to create and use a logger instance for a
Expand Down Expand Up @@ -112,12 +108,11 @@ Example Code:
log.Debug("This is a debug message")
}
Format
# Format
Golog sets colors to levels when its `Printer.Output` is actual a compatible terminal
which can renders colors, otherwise it will downgrade itself to a white foreground.
Golog has functions to print a formatted log too.
Example Code:
Expand All @@ -127,24 +122,21 @@ Example Code:
golog.Errorf("[%d] This is an info %s", 1, "formatted log")
golog.Debugf("[%d] This is an info %s", 1, "formatted log")
Output
# Output
Golog takes a simple `io.Writer` as its underline Printer's Output.
Example Code:
golog.SetOutput(io.Writer)
You can even override the default line braker, "\n", by using the `golog#NewLine` function at startup.
Example Code:
golog.NewLine("\r\n")
Levels
# Levels
Golog is a leveled logger, therefore you can set a level and print
whenever the print level is valid with the set-ed one.
Expand All @@ -162,14 +154,12 @@ Available built'n levels are:
// DebugLevel will print on any level, errors, warnings, infos and debug messages
DebugLevel
Below you'll learn a way to add a custom level or modify an existing level.
The default colorful text(or raw text for unsupported outputs) for levels
can be overridden by using the `golog#ErrorText, golog#WarnText, golog#InfoText and golog#DebugText`
functions.
Example Code:
package main
Expand Down Expand Up @@ -203,10 +193,8 @@ Example Code:
golog.Debug("This is a debug message")
}
Golog gives you the power to add or modify existing levels is via Level Metadata.
Example Code:
package main
Expand Down Expand Up @@ -248,12 +236,10 @@ Example Code:
myLogger.Logf(SuccessLevel, "This is a success log message with green color")
}
The logger's level can be changed via passing one of the
level constants to the `Level` field or by
passing its string representation to the `SetLevel` function.
Example Code:
golog.SetLevel("disable")
Expand All @@ -263,8 +249,7 @@ Example Code:
golog.SetLevel("info")
golog.SetLevel("debug")
Integrations
# Integrations
Transaction with your favorite, but deprecated logger is easy.
Golog offers two basic interfaces, the `ExternalLogger` and the `StdLogger`
Expand Down Expand Up @@ -300,8 +285,7 @@ Outline:
// Look `golog#Handle` for more.
InstallStd(logger StdLogger)
Logrus Integration
# Logrus Integration
Example Code:
Expand Down Expand Up @@ -348,8 +332,7 @@ Example Code:
golog.Error("this error message will be visible as text")
}
Standard `log.Logger` Integration
# Standard `log.Logger` Integration
Example Code:
Expand Down Expand Up @@ -377,8 +360,7 @@ Example Code:
golog.Warn("this info message will not be visible")
}
That's the basics
# That's the basics
But you should have a basic idea of the golog package by now, we just scratched the surface.
If you enjoy what you just saw and want to learn more, please follow the below links:
Expand All @@ -390,4 +372,4 @@ Examples:
package golog

// Version is the version string representation of the "golog" package.
const Version = "0.1.7"
const Version = "0.1.8"
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/kataras/golog

go 1.18
go 1.19

require github.com/kataras/pio v0.0.11

Expand Down
7 changes: 7 additions & 0 deletions golog.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@ package golog

import (
"io"
"time"

"github.com/kataras/pio"
)

// Now is called to set the log's timestamp value.
// It can be altered through initialization of the program
// to customize the behavior of getting the current time.
var Now func() time.Time = time.Now

// NewLine can override the default package-level line breaker, "\n".
// It should be called (in-sync) before the print or leveled functions.
//
Expand Down Expand Up @@ -199,6 +205,7 @@ func Install(logger ExternalLogger) {
// it can be used only once per `golog#Logger` instance.
//
// Example Code:
//
// import "log"
// myLogger := log.New(os.Stdout, "", 0)
// InstallStd(myLogger)
Expand Down
Loading

0 comments on commit cab8303

Please sign in to comment.