go.charczuk.com@v0.0.0-20240327042549-bc490516bd1a/sdk/logutil/info.go (about)

     1  /*
     2  
     3  Copyright (c) 2023 - Present. Will Charczuk. All rights reserved.
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file at the root of the repository.
     5  
     6  */
     7  
     8  package logutil
     9  
    10  import (
    11  	"fmt"
    12  	"log"
    13  )
    14  
    15  // Info prints an informational message with a given format and arguments.
    16  func Info(l *log.Logger, message string) {
    17  	if l == nil {
    18  		return
    19  	}
    20  	if l.Flags()&Linfo == 0 {
    21  		return
    22  	}
    23  	l.Output(SDKStackDepth(), fmt.Sprintf("INFO: "+message))
    24  }
    25  
    26  // Infof prints an informational message with a given format and arguments.
    27  func Infof(l *log.Logger, format string, args ...interface{}) {
    28  	if l == nil {
    29  		return
    30  	}
    31  	if l.Flags()&Linfo == 0 {
    32  		return
    33  	}
    34  	l.Output(SDKStackDepth(), fmt.Sprintf("INFO: "+format, args...))
    35  }