Docker's log and Golang runtime

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

The log of Docker is log.go under the Pkg/log path. Very simple:

1. Altogether 4 levels of debug,info, Error,fatal.

2. Info is output directly to stdout, and the others are output to stderr (including debug). Fatal output log will automatically exit

3. The actual output is the LOGF function. The Golang runtime Library is used, as follows

_, file,line, OK : =runtime. Caller(2)

4. Runtime. Caller ()

Func Caller (skip int) (PC UIntPtr, file string, line int, OK BOOL)
Skip if it is 0, returns the function name, file, program pointer that is currently calling the caller function, pc,1 is the previous function, and so on

5. Runtime. Breakpoint ()

Set breakpoints in the program (when not in use with the IDE), with GDB

Reference:

http://blog.studygolang.com/2012/12/gdb%E8%B0%83%E8%AF%95go%E7%A8%8B%E5%BA%8F/

http://golang.org/pkg/runtime/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.