github.com/grailbio/base@v0.0.11/cmdutil/logging.go (about)

     1  // Copyright 2018 GRAIL, Inc. All rights reserved.
     2  // Use of this source code is governed by the Apache-2.0
     3  // license that can be found in the LICENSE file.
     4  
     5  // Package cmdutil provides utility routines for implementing command line
     6  // tools.
     7  package cmdutil
     8  
     9  import (
    10  	"fmt"
    11  	"os"
    12  	"strings"
    13  
    14  	"v.io/x/lib/vlog"
    15  )
    16  
    17  // Fatalf mirrors log.Fatalf with no prefix and no timestamp.
    18  func Fatalf(format string, args ...interface{}) {
    19  	m := fmt.Sprintf(format, args...)
    20  	fmt.Fprint(os.Stderr, strings.TrimSuffix(m, "\n")+"\n")
    21  	vlog.FlushLog()
    22  	os.Exit(1)
    23  }
    24  
    25  // Fatal mirrors log.Fatal with no prefix and no timestamp.
    26  func Fatal(args ...interface{}) {
    27  	m := fmt.Sprint(args...)
    28  	fmt.Fprint(os.Stderr, strings.TrimSuffix(m, "\n")+"\n")
    29  	vlog.FlushLog()
    30  	os.Exit(1)
    31  }