@@ -44,6 +44,8 @@ type PeerSwapConfig struct {
4444 DataDir string `long:"datadir" description:"peerswap datadir"`
4545 LogLevel LogLevel `long:"loglevel" description:"loglevel (1=Info, 2=Debug)"`
4646
47+ LogRotation LogRotationConfig `group:"Log rotation" namespace:"logrotation"`
48+
4749 LndConfig * LndConfig `group:"Lnd Grpc config" namespace:"lnd"`
4850 ElementsConfig * OnchainConfig `group:"Elements Rpc Config" namespace:"elementsd"`
4951 LWKConfig * lwk.Conf
@@ -139,6 +141,15 @@ type LndConfig struct {
139141 MacaroonPath string `long:"macaroonpath" description:"path to the macaroon (admin.macaroon or custom baked one)"`
140142}
141143
144+ type LogRotationConfig struct {
145+ // In megabytes
146+ MaxSize int `long:"maxsize" description:"maximum size in megabytes of the log file before rotation."`
147+ MaxBackups int `long:"maxbackups" description:"maximum number of old log files to retain."`
148+ // In days
149+ MaxAge int `long:"maxage" description:"maximum number of days to retain old log files."`
150+ Compress bool `long:"compress" description:"whether to compress log files using gzip"`
151+ }
152+
142153func DefaultConfig () * PeerSwapConfig {
143154 return & PeerSwapConfig {
144155 Host : DefaultPeerswapHost ,
@@ -154,6 +165,7 @@ func DefaultConfig() *PeerSwapConfig {
154165 BitcoinEnabled : DefaultBitcoinEnabled ,
155166 ElementsConfig : defaultLiquidConfig (),
156167 LogLevel : DefaultLogLevel ,
168+ LogRotation : defaultLogRotationConfig (),
157169 }
158170}
159171
@@ -170,6 +182,15 @@ func defaultLiquidConfig() *OnchainConfig {
170182 }
171183}
172184
185+ func defaultLogRotationConfig () LogRotationConfig {
186+ return LogRotationConfig {
187+ MaxSize : 10 ,
188+ MaxBackups : 5 ,
189+ MaxAge : 28 ,
190+ Compress : true ,
191+ }
192+ }
193+
173194func LWKFromIniFileConfig (filePath string ) (* lwk.Conf , error ) {
174195 type LWK struct {
175196 SignerName string `long:"signername" description:"name of the signer"`
0 commit comments