bitcoinconfig.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package bitcoin
  2. import (
  3. "fmt"
  4. "runtime"
  5. "strings"
  6. "time"
  7. )
  8. type config struct {
  9. Title string
  10. WalletInfo walletinfo `toml:"walletinfo"`
  11. Limit limit `toml:"limit"`
  12. Rpc rpc `toml:"rpc"`
  13. Db databaseinfo `toml:"db"`
  14. Pubkey pubkeyinfo `toml:"pubkey"`
  15. Count count `toml:"count"`
  16. }
  17. type limit struct {
  18. Fee string
  19. }
  20. type walletinfo struct {
  21. WalletKey string
  22. }
  23. type rpc struct {
  24. Rpcuser string
  25. Rpcpassword string
  26. Rpchost string
  27. Rpcport int
  28. }
  29. type databaseinfo struct {
  30. DbPath string
  31. }
  32. type pubkeyinfo struct {
  33. Pubkeystr string
  34. }
  35. type count struct {
  36. Startcount uint32
  37. Endcount uint32
  38. }
  39. func LOG(info string, format string, v ...interface{}) {
  40. _, file, line, _ := runtime.Caller(1)
  41. fpaths := strings.Split(file, "/")
  42. size := len(fpaths)
  43. var sysflag = "lite package"
  44. if format == "" {
  45. fmt.Printf("%v |%v|%v|%v()|%v|%v\n", time.Now().Format("2006-01-02 15:04:05"), info, sysflag, fpaths[size-1], line, fmt.Sprintln(v...))
  46. } else {
  47. fmt.Printf("%v|%v|%v|%v|%v|%v\n", time.Now().Format("2006-01-02 15:04:05"), info, sysflag, fpaths[size-1], line, fmt.Sprintf(format, v...))
  48. }
  49. }