Documentation
¶
Overview ¶
Internal operations mostly related to App, configurations, and logger
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Notify ¶
func Notify(connection *dbus.Conn, appName string, icon string, title string, body string, duration time.Duration) error
Notify sends a desktop notifications (standalone version)
func SetupHomeDirectories ¶
func SetupHomeDirectories() string
SetupHomeDirectories creates secret-service necessary directories under: '~/secret-service' .secret-service ├── secretservice-cli │ └── logs └── secretserviced
├── config.yaml ├── db.json └── logs └── secretserviced.log
func SetupLogger ¶
func SetupLogger(app *AppData)
SetupLogger sets up logger according to config file
Types ¶
type AppData ¶
type AppData struct { // Service (secretserviced) home directory ServiceHome string // dbus session connection Connection *dbus.Conn // configurations data structure Config *Config // Service data structure Service *service.Service }
App data structure, all other data are children of App in a hierarchial model
func (*AppData) SetupLogger ¶
func (app *AppData) SetupLogger()
SetupLogger sets up logger based on configurations
type Config ¶
type Config struct { // Config file version Version string `yaml:"version"` // Encrypt database using AES-CBC-256 Encryption bool `yaml:"encryption"` // Desktop notification icon Icon string `yaml:"icon"` // Allow database to be exported without encryption AllowDbExport bool `yaml:"allowDbExport"` // Prompting when necessary Prompting bool `yaml:"prompting"` // Absolute path to log file LogFile string `yaml:"logFile"` // Logger is enabled or not Logging bool `yaml:"logging"` // Log file format: 'text' or 'json' LogFormat string `yaml:"logFormat"` // Level of logging verbosity // 0-6 where 6 is the most verbose and 0 logs very severe events LogLevel LogLevel `yaml:"logLevel"` // Maximum log size in MB before rotation LogMaxSize int `yaml:"logMaxSize"` // Maximum number of rotated log files (backups) LogMaxBackups int `yaml:"logMaxBackups"` // Maximum age (in days) of a log file before rotation // Between size and age which comes first makes log rotate LogMaxAge int `yaml:"logMaxAge"` // Compress backup log files (true) or not (false) LogCompress bool `yaml:"logCompress"` // Log report caller function (makes logs larger) LogReportCaller bool `yaml:"logReportCaller"` }
type LogLevel ¶
type LogLevel uint8
const ( // PanicLevel level, highest level of severity. Logs and then calls panic with the // message passed to Debug, Info, ... PanicLevel LogLevel = iota // 0 // FatalLevel level. Logs and then calls `logger.Exit(1)`. It will exit even if the // logging level is set to Panic. FatalLevel // 1 // ErrorLevel level. Logs. Used for errors that should definitely be noted. // Commonly used for hooks to send errors to an error tracking service. ErrorLevel // 2 // WarnLevel level. Non-critical entries that deserve eyes. WarnLevel // 3 // InfoLevel level. General operational entries about what's going on inside the // application. InfoLevel // 4 // DebugLevel level. Usually only enabled when debugging. Very verbose logging. DebugLevel // 5 // TraceLevel level. Designates finer-grained informational events than the Debug. TraceLevel // 6 )
Click to show internal directories.
Click to hide internal directories.