apsdehal / go-logger Goto Github PK
View Code? Open in Web Editor NEWSimple logger for Go programs. Allows custom formats for messages.
License: BSD 3-Clause "New" or "Revised" License
Simple logger for Go programs. Allows custom formats for messages.
License: BSD 3-Clause "New" or "Revised" License
Hello,
Thank you the library.
Please consider to add filter level, to allow show only relevant levels.
Your project looks really nice!
When reading the examples, I propose to streamline function names to correspond to the naming scheme of fmt
, log
and testing
: fmt.Printf()
, log.Printf()
, t.Errorf()
are all using lowercase f
, whereas your package uses WarningF()
DebugF()
with capital F
s.
Proposal: Use lowercase f
in your package as well, e.g. Warningf()
Using this file:
package main
import "github.com/apsdehal/go-logger"
func main () {
aa, _ := logger.New(1, 1)
aa.Warning("bbbbb")
}
I get this result:
[33m#1 2019-06-14 06:39:31 log.go:8 ▶ WAR bbbbb [0m
Seems not have SetOutput
method similar to log.SetOputput
hi,
#1 2018-01-18 00:07:37 log.go:25 ▶ WAR TransactionID=opcli InstancesID=main Message=This is test []
it seems the line is not correct,the line should be the line the number when i use log.DebugF 、log.WarningF .. and so on ?
It would be nice to be able to silence certain priority level logs. For example: error, notice, and info level logs could be silenced while critical, debug, and warning logs are still outputted.
// Use log levels to set your log priority
log2.SetLogLevel(DebugLevel)
Since this code is not in the logger package, it doesn't have access to DebugLevel
. Use this instead:
// Use log levels to set your log priority
log2.SetLogLevel(logger.DebugLevel)
Same for the WarningLevel 3 lines down.
For example, there could be multiple subsystems in a project, and it would nice to be able to selectively enable or disable logs with a certain tag.
The format option %{time}
does not work without format description as you can see in this MWE:
package main
import (
"os"
"github.com/apsdehal/go-logger"
)
func main() {
log, err := logger.New("test", 1, os.Stdout)
if err != nil {
panic(err) // Check for error
}
log.SetFormat("%{time} [%{level}] %{message}")
log.Debug("not working test")
log.SetFormat("%{time:2006-01-02 15:04:05} [%{level}] %{message}")
log.Debug("working test")
}
output is
[DEBUG] not working test
2018-07-04 00:52:12 [DEBUG] working test
I want to use Sourcegraph for go-logger code search, browsing, and usage examples. Can an admin enable Sourcegraph for this repository? Just go to https://sourcegraph.com/github.com/apsdehal/go-logger. (It should only take 30 seconds.)
Thank you!
Dear Amanpreet Singh,
I am a Ph.D. student at the University of São Paulo (Brazil). We would like to understand how and how much Open Source Communities benefit from participating in Google Summer of Code (GSoC). We believe that your experience in GSoC is valuable and could help us achieve that. In a 1-minute questionnaire, we would like to know:
Concerning the project entitled "Annotation Tool that extracts information and feed them on Wikidata" developed in GSoC 2014.
Do you have a GitHub repository for the GSoC project? If so, could you provide us with the link to the project?
Have you continued committing code or opening issues to the GSoC project after GSoC? (Yes / No) If so, code, issues or both?
Have you continued committing code or opening issues to other OSS projects after GSoC? (Yes / No) If so, code, issues or both?
Could we use aggregate data from your participation in GSoC and other OSS projects in our research?
The following link contains a sample of our work and how we would use your data:
https://ieeexplore.ieee.org/document/8094410/
Regards,
Jefferson
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.