refactor: renamed golog to log

This commit is contained in:
Martin Riedl 2025-02-20 18:06:56 +01:00
parent b44771fddb
commit 0819e83691
Signed by: martinr92
GPG key ID: FB68DA65516A804C
14 changed files with 20 additions and 18 deletions

View file

@ -1,11 +1,11 @@
# goLog # log
GoLog is a simple logging framework for golang. Log is a simple logging framework for golang.
## Getting Started ## Getting Started
```golang ```golang
import log "gitlab.com/martinr92/golog" import "git.martin-riedl.de/golang/log"
func main(){ func main(){
log.Default.Info("My First Info Message") log.Default.Info("My First Info Message")
@ -17,7 +17,7 @@ func main(){
Create a new log instance (instead of using the `Default`). Create a new log instance (instead of using the `Default`).
```golang ```golang
import log "gitlab.com/martinr92/golog" import "git.martin-riedl.de/golang/log"
var myLog := log.NewLoggerDefault() var myLog := log.NewLoggerDefault()
myLog.Info("My First Info Message") myLog.Info("My First Info Message")
@ -32,7 +32,7 @@ myLog.Info("My First Info Message")
The following sample creates 2 outputs. The first sends a key/value format to stdout. The second writes messages as JSON format to stdout. The following sample creates 2 outputs. The first sends a key/value format to stdout. The second writes messages as JSON format to stdout.
```golang ```golang
import log "gitlab.com/martinr92/golog" import "git.martin-riedl.de/golang/log"
var output1 := NewOutput(log.LevelInfo, NewFormatterKeyValue(), NewPrinterStdout() var output1 := NewOutput(log.LevelInfo, NewFormatterKeyValue(), NewPrinterStdout()
var output2 := NewOutput(log.LevelError, NewFormatterJSON(), NewPrinterStdout()) var output2 := NewOutput(log.LevelError, NewFormatterJSON(), NewPrinterStdout())

View file

@ -1,7 +1,8 @@
package main package main
import ( import (
log "gitlab.com/martinr92/golog" "git.martin-riedl.de/golang/log"
"runtime"
) )
func main() { func main() {
@ -10,4 +11,5 @@ func main() {
func someMethod() { func someMethod() {
log.Default.Info("Hello World") log.Default.Info("Hello World")
log.Default.With("os", runtime.GOOS).Info("environment detected")
} }

View file

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package golog package log
import ( import (
"fmt" "fmt"

View file

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package golog package log
type Formatter interface { type Formatter interface {
Begin(*Entry) Begin(*Entry)

View file

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package golog package log
import ( import (
"encoding/json" "encoding/json"

View file

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package golog package log
import "testing" import "testing"

View file

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package golog package log
import ( import (
"fmt" "fmt"

View file

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package golog package log
import "testing" import "testing"

2
go.mod
View file

@ -1,3 +1,3 @@
module gitlab.com/martinr92/golog module git.martin-riedl.de/golang/log
go 1.20 go 1.20

View file

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package golog package log
type Level uint32 type Level uint32

View file

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package golog package log
import ( import (
"runtime" "runtime"

View file

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package golog package log
import "sync" import "sync"

View file

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package golog package log
type Printer interface { type Printer interface {
Write(p []byte) Write(p []byte)

View file

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package golog package log
import "os" import "os"