https://github.com/rusq/dlog
Standard Logger Debug Extension for Go Language.
https://github.com/rusq/dlog
debug golang golang-lib golang-library logger logging minimalist
Last synced: about 2 months ago
JSON representation
Standard Logger Debug Extension for Go Language.
- Host: GitHub
- URL: https://github.com/rusq/dlog
- Owner: rusq
- License: bsd-3-clause
- Created: 2020-05-26T05:16:14.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-21T06:29:16.000Z (over 3 years ago)
- Last Synced: 2025-03-28T10:18:10.554Z (over 1 year ago)
- Topics: debug, golang, golang-lib, golang-library, logger, logging, minimalist
- Language: Go
- Homepage:
- Size: 42 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
====================
Standard Logger Ex
====================
.. image:: https://pkg.go.dev/badge/github.com/rusq/dlog.svg
:target: https://pkg.go.dev/github.com/rusq/dlog
What is this?
=============
This is a simple wrapper around the standard go runtime logger with only one
goal:
* ADD DEBUG OUTPUT FUNCTIONS.
Functions that are available for the caller:
* All those in "log" AND
* Debug
* Debugf
* Debugln
On the package base level these functions will print output only if the
``DEBUG`` environment variable is present and have some non-empty value.
Otherwise, one can construct a new logger::
func New(out io.Writer, prefix string, flag int, debug bool) *Logger
for the flags, one could use the values from the standard logger.
Usage
=====
Import it in your project replacing "log" import entry:
.. code:: go
import (
log "github.com/rusq/dlog"
)
Use:
.. code:: go
log.Debug("hello debug!")
Check if debug is enabled:
.. code:: go
log.IsDebug()