Go/Packages

[Go] Package log

llHoYall 2020. 11. 30. 20:40

Package log implements a simple logging package.

Methods

Fatal

Fatal is equivalent to Print() followed by a call to os.Exit(1).

func Fatal(v ...interface{})

Fatalf

Fatalf is equivalent to Printf() followed by a call to os.Exit(1).

func Fatalf(format string, v ...interface{})

Fatalln

Fatalln is equivalent to Println() followed by a call to os.Exit(1).

Panic

Panic is equivalent to Print() followed by a call to panic().

func Panic(v ...interface{})

Panicf

Panicf is equivalent to Printf() followed by a call to panic().

func Panicf(format string, v ...interface{})

Panicln

Panicln is equivalent to Println() followed by a call to panic().

func Panicln(v ...interface{})

Print

Print calls Output() to print to the standard logger.

func Print(v ...interface{})

Printf

Printf calls Output() to print to the standard logger.

func Printf(format string, v ...interface{})

Println

Println calls Output() to print to the standard logger.

func Println(v ...interface{})

Usage

package main

import "log"

func main() {
  log.Println("This is test log.")
}
반응형