Comments (2)
Sample usage of log manager (not a working code, but gives a hint about how we would love it):
package main
import barkLogger github.com/techrail/bark/client
func init () {
// log.Println("some log")
// log.Printf("some importantlog: %v", )
log := barkLogger.NewClient("http://bark.example.com:8080", "INFO", "Service_Name", "optional_session_name") // when you only have a client and the server is already running elsewhere
/*
HTTP POST http://bark.example.com:8080/insertSingle
{
"level": "info",
"serviceName": "Service_Name",
"sessionName": "currenthostname_or-Podname",
"code": "000000",
"message": "what was sent by the Errorf method",
"moreData": {}
}
*/
// Either the above code or the below one!
// log := barkLogger.NewClientPlusServer("postgresql://user:pass@server:port/db_name", "INFO", "Service_Name") // When you want to start the server as part of the current program itself
log.Error("Something bad happened") // Will send to bark AND print it as well with ERROR level message
log.Errorf("Something bad happened: %v", err) // Will send the formatted message to bark AND print it as well with ERROR level message
log.Printf("Something bad happened: %v\n", err) // Will send the formatted message to bark AND print it as well with default (INFO) level message
log.Errorf("E#1KQWPR - Something bad happened: %v", err) // Will send the formatted message to bark AND print it as well with ERROR level message
log.Errorf("I#1KQWPR - Something bad happened: %v", err) // Will send the formatted message to bark AND print it as well with ERROR level message
log.Errorf("W#1KQWPR - Something bad happened: %v", err) // Will send the formatted message to bark AND print it as well with ERROR level message
log.Errorf("P#1KQWPR - Something bad happened: %v", err) // Will send the formatted message to bark AND print it as well with ERROR level message
}
type AppError struct {
HttpCode int
Level string // info, warning, sfgsdfaf
Code string // LMID like 1KQWVQ
Message string // show to your user -> Internal error - cannot register user
DevMsg string // show to only the developers -> DB constraint "unique code" clash
Tym time.Time
Data Json
WrappedError *AppError
}
from bark.
This is completed with #63
from bark.
Related Issues (20)
- Writing logs to plain text file HOT 1
- Provide more details in / route
- Create a Sample Application Using Bark and Bark Client
- Create a visualization of where bark stands
- FEAT : Add webhook support to bark client HOT 2
- Prefix env var DATABASE_URL
- Setup Github Actions pipeline for testing HOT 1
- Write a Log file parser for Uber Zap HOT 1
- Delete the .env file
- Implement the slog interface in client HOT 1
- Rename the field `session_name` to `service_instance_name`
- Implement Webhooks for ALERT level logs HOT 1
- Create the raw function in the client to send a full barklog model HOT 1
- Fix the golang version requirement in README HOT 2
- Client LogParser function sets the wrong default log level HOT 1
- Update README to reflect the latest Docker Images. HOT 1
- Improve the insert performance in the server HOT 5
- Feature: create a function in client which can send logs to db without making a network call HOT 1
- Create the releaser script
- Option to print or disable Debug level logs in the client
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bark.