
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
github.com/lexographics/logar
A lightweight, flexible management library for Go applications, providing logging, analytics, server actions, and more.
go get sadk.dev/logar
Logar provides a suite of tools. Here's a basic logging example:
package main
import (
"sadk.dev/logar"
// Import other necessary logar sub-packages for specific features
// e.g., "sadk.dev/logar/logarweb" for the web UI
)
func main() {
// Create a new Logar application instance
// The New() function accepts various configuration options for logging,
// analytics, actions, web panel, etc.
app, err := logar.New(
logar.WithAppName("My Awesome App"), // Sets the application name
logar.AddModel("System Logs", "system-logs"),
logar.AddModel("User Activity", "user-activity"),
// Add a console proxy to output all logs to terminal
// logar.AddProxy(proxy.NewProxy(
// consolelogger.New(),
// proxy.NewFilter(),
// )),
// For the web UI, actions, and analytics, additional setup is required.
// See the examples directory for detailed demonstrations.
)
if err != nil {
// Handle error
}
// Basic logging
app.GetLogger().Info("system-logs", "App Started. No errors", "startup")
// To explore server actions, analytics, feature flags, and the web UI,
// please refer to the detailed examples in the 'examples/' directory
// in the project repository.
}
Logar is configured using functional options with the logar.New()
constructor.
// Configure Logar with various options
app, err := logar.New(
logar.WithAppName("My App"),
logar.WithDatabase("logs.db"), // For persisting logs and analytics data
logar.WithAdminCredentials("admin", "securepassword"), // For web UI authentication
// Logging specific configurations
logar.AddModel("System Events", "system-events"),
// Action specific configurations
logar.WithAction("Server/Echo", "Description of action", func(message string) string {
// Action logic here
return "Result: " + message
}),
// Analytics can be automatically collected via middleware
// Or events can be registered manually:
// app.GetAnalytics().RegisterEvent(...)
// Forwards logs to the proxy based on given filters (example)
// logar.AddProxy(proxy.NewProxy(
// consolelogger.New(),
// proxy.NewFilter(),
// )),
// Conditional options
logar.If(env == "test",
logar.WithDatabase("test.db"),
),
logar.IfElse(env == "prod",
logar.WithDatabase("prod.db"),
logar.WithDatabase("dev.db"),
)
)
if err != nil {
// Handle error
}
// Access different modules:
logger := app.GetLogger()
analyticsEngine := app.GetAnalytics()
actionManager := app.GetActionManager()
featureFlagManager := app.GetFeatureFlags()
// Start the web server (typically using net/http or a framework like Echo)
// and integrate logarweb.ServeHTTP for the Logar web panel.
// e.g., e.Any("/logar/*", echo.WrapHandler(logarweb.ServeHTTP("http://localhost:3000", "/logar", app)))
For detailed examples covering logging, the web UI, server actions, analytics, feature flags, and integrations with web frameworks like Echo, see the examples/
directory in the GitHub repository.
See the documentation for more API details.
MIT
If you'd like to contribute to the project, please open an issue on GitHub to discuss your ideas or report bugs.
Warning: This project does not currently adhere strictly to semver, and API compatibility is not guaranteed between minor and patch updates.
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.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.