log.go 683 B

1234567891011121314151617181920212223242526
  1. // Copyright (c) 2013-2017 The btcsuite developers
  2. // Copyright (c) 2017 The Decred developers
  3. // Copyright (c) 2019 Caleb James DeLisle
  4. // Use of this source code is governed by an ISC
  5. // license that can be found in the LICENSE file.
  6. package main
  7. // directionString is a helper function that returns a string that represents
  8. // the direction of a connection (inbound or outbound).
  9. func directionString(inbound bool) string {
  10. if inbound {
  11. return "inbound"
  12. }
  13. return "outbound"
  14. }
  15. // pickNoun returns the singular or plural form of a noun depending
  16. // on the count n.
  17. func pickNoun(n uint64, singular, plural string) string {
  18. if n == 1 {
  19. return singular
  20. }
  21. return plural
  22. }