github.com/Kindred87/Obsidian@v0.0.0-20210809203756-86936424b848/server/logging.go (about)

     1  package server
     2  
     3  import "fmt"
     4  
     5  // logRequest prints a statements prepended with "Received request for "
     6  func logRequest(r string) {
     7  	fmt.Printf("Received request for %s.\n", r)
     8  }
     9  
    10  // logActionAndTargets prints action followed by the contents of s.
    11  // A colon is automatically appended to action.
    12  func logActionAndTargets(action string, s []string) {
    13  	fmt.Printf("%s: ", action)
    14  
    15  	for i, a := range s {
    16  		fmt.Printf("%v", a)
    17  		if i < len(s)-1 {
    18  			fmt.Print(", ")
    19  		}
    20  	}
    21  	fmt.Print(".\n")
    22  }
    23  
    24  // logProcessed prints a statement indicating that a request was processed.
    25  func logProcessed() {
    26  	fmt.Print("Request processed successfully.\n\n")
    27  }
    28  
    29  func logError(err error) {
    30  	fmt.Printf("An error occurred: %s.\n\n", err.Error())
    31  }