Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
github.com/saurav-suman/logging-go
logging-go
?logging-go
supports log levels And you can publish log to rabbitMQ for now.
Logging libraries are like opinions, everyone needs one depends upon the need. You can add multiple parameters to the message for log, critical, info, debug, warn which will be transformed to a single string.
logging-go
different?Publish to RabbitMQ using a logging-go instantiated like so:
import (
logger "github.com/Saurav-Suman/logging-go"
)
package main
import (
logger "logging-go"
)
/*
ANSIC = "Mon Jan _2 15:04:05 2006"
UnixDate = "Mon Jan _2 15:04:05 MST 2006"
RubyDate = "Mon Jan 02 15:04:05 -0700 2006"
RFC822 = "02 Jan 06 15:04 MST"
RFC822Z = "02 Jan 06 15:04 -0700" // RFC822 with numeric zone
RFC850 = "Monday, 02-Jan-06 15:04:05 MST"
RFC1123 = "Mon, 02 Jan 2006 15:04:05 MST"
RFC1123Z = "Mon, 02 Jan 2006 15:04:05 -0700" // RFC1123 with numeric zone
RFC3339 = "2006-01-02T15:04:05Z07:00"
RFC3339Nano = "2006-01-02T15:04:05.999999999Z07:00"
Kitchen = "3:04PM"
// Handy time stamps.
Stamp = "Jan _2 15:04:05"
StampMilli = "Jan _2 15:04:05.000"
StampMicro = "Jan _2 15:04:05.000000"
StampNano = "Jan _2 15:04:05.000000000"
*/
type CustomResponse struct {
Success bool
StatusCode int
Message string
}
func main() {
log := logger.SystemLoggerConfig{
LoggerTimeFormat: "time.RFC3339",
RabbitmqURL: "amqp://guest:guest@127.0.0.1:5672/",
QueuePrefix: "ayopop",
QueueNames: logger.QueueCategory{
Api: "api",
Debug: "debug",
Info: "info",
Warn: "warning",
Error: "error",
Critical: "critical",
},
}
// You can create your custom request
var response types.CustomResponse
response.Success = true
response.StatusCode = 200
response.Message = "OK."
responseJson, err := json.Marshal(response)
if err != nil {
fmt.Println("Error while JSON marshal")
}
log.Info(string(responseJson), "Another message", "Another awesome message")
log.Critical("Divide by zero", "This is another message')
log.Info("Created", "since", 1990)
log.Api(logger.ApiLoggerFields{Ip: "192.168.0.1",
Url: "getRechargeData",
StatusCode: 200,
Request: "Name=saurav",
Method: "POST",
Headers: "",
Response: "Result=True",
Timestamp: "",
})
}
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.