본문 바로가기
Go/Packages

[Go] Package log

by llHoYall 2020. 11. 30.

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.")
}

'Go > Packages' 카테고리의 다른 글

[Go] Package os  (0) 2020.12.02
[Go] Package testing  (0) 2020.11.30
[Go] Package bufio  (0) 2020.10.31
[Go] Package errors  (0) 2020.10.29
[Go] Package math  (0) 2020.10.27

댓글