
Security News
Bun 1.2.19 Adds Isolated Installs for Better Monorepo Support
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.
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.
Security News
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.
Security News
Popular npm packages like eslint-config-prettier were compromised after a phishing attack stole a maintainer’s token, spreading malicious updates.
Security News
/Research
A phishing attack targeted developers using a typosquatted npm domain (npnjs.com) to steal credentials via fake login pages - watch out for similar scams.