本文整理匯總了Golang中github.com/sqp/godock/libs/cdtype.Logger.Info方法的典型用法代碼示例。如果您正苦於以下問題:Golang Logger.Info方法的具體用法?Golang Logger.Info怎麽用?Golang Logger.Info使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/sqp/godock/libs/cdtype.Logger
的用法示例。
在下文中一共展示了Logger.Info方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: NewYTDLFile
// NewYTDLFile creates a video file downloader.
//
func NewYTDLFile(log cdtype.Logger, url string) (Filer, error) {
info, e := ytdl.GetVideoInfo(url)
if e != nil {
return nil, fmt.Errorf("Unable to fetch video info: %s", e.Error())
}
// formats := info.Formats
// // parse filter arguments, and filter through formats
// for _, filter := range options.filters {
// filter, e := parseFilter(filter)
// if !log.Err(e) {
// formats = filter(formats)
// }
// }
// if len(formats) == 0 {
// return nil, fmt.Errorf("No formats available that match criteria: %s", e.Error())
// }
log.Info("Author", info.Author)
log.Info("Description", info.Description)
log.Info("ID", info.ID)
log.Info("vid", info)
var list []*Format
for _, v := range info.Formats {
nf := &Format{
Itag: v.Itag,
Extension: v.Extension,
Resolution: v.Resolution,
VideoEncoding: v.VideoEncoding,
AudioEncoding: v.AudioEncoding,
AudioBitrate: v.AudioBitrate,
}
s := v.ValueForKey("clen")
if s != nil {
nf.Size, e = strconv.Atoi(s.(string))
nf.Size /= 1000000
log.Err(e, "convert size. format=", v.Itag)
// } else {
// log.Info("no clen", v.Itag)
}
list = append(list, nf)
}
// pretty.Println(info)
return &YTDLFile{
VideoInfo: *info,
formats: list,
log: log,
}, nil
}
示例2: Init
// Init will try to load the own config data from the file, and create it if missing.
//
func Init(log cdtype.Logger, file string, e error) error {
if e != nil {
return e
}
// Create file if needed.
if !files.IsExist(file) {
source := globals.DirShareData(GuiFilename)
e := files.CopyFile(source, file, os.FileMode(0644))
if e != nil {
return e
}
log.Info("created config file", file)
}
// Create our user settings
Settings = ConfigSettings{
File: file,
log: log,
}
return Settings.Load()
}