code
stringlengths
10
1.34M
language
stringclasses
1 value
/* Copyright 2012, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disc...
Go
/* Copyright 2012, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disc...
Go
/* Copyright 2012, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disc...
Go
/* Copyright 2012, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disc...
Go
/* Copyright 2012, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disc...
Go
/* Copyright 2012, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disc...
Go
/* Copyright 2012, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disc...
Go
/* Copyright 2012, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disc...
Go
/* Copyright 2012, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disc...
Go
/* Copyright 2012, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disc...
Go
/* Copyright 2012, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disc...
Go
/* Copyright 2012, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disc...
Go
/* Copyright 2012, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disc...
Go
/* Copyright 2012, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disc...
Go
/* Copyright 2012, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disc...
Go
/* Copyright 2012, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disc...
Go
/* Copyright 2012, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disc...
Go
/* Copyright 2012, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disc...
Go
/* Copyright 2012, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disc...
Go
/* Copyright 2012, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disc...
Go
/* Copyright 2012, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disc...
Go
/* Copyright 2012, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disc...
Go
/* Copyright 2012, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disc...
Go
/* Copyright 2012, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disc...
Go
/* Copyright 2012, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disc...
Go
/* Copyright 2012, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disc...
Go
/* Copyright 2012, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disc...
Go
/* Copyright 2012, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disc...
Go
/* Copyright 2012, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disc...
Go
// Copyright 2011 The Snappy-Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package snappy implements the snappy block-based compression format. // It aims for very high speeds and reasonable compression. // // The C++ snappy ...
Go
// Copyright 2011 The Snappy-Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package snappy import ( "encoding/binary" "errors" ) // ErrCorrupt reports that the input is invalid. var ErrCorrupt = errors.New("snappy: corrupt in...
Go
// Copyright 2011 The Snappy-Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package snappy import ( "encoding/binary" ) // We limit how far copy back-references can go, the same as the C++ code. const maxOffset = 1 << 15 // e...
Go
// Copyright 2011 The Snappy-Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package snappy implements the snappy block-based compression format. // It aims for very high speeds and reasonable compression. // // The C++ snappy ...
Go
// Copyright 2011 The Snappy-Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package snappy import ( "encoding/binary" ) // We limit how far copy back-references can go, the same as the C++ code. const maxOffset = 1 << 15 // e...
Go
// Copyright 2011 The Snappy-Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package snappy import ( "encoding/binary" "errors" ) // ErrCorrupt reports that the input is invalid. var ErrCorrupt = errors.New("snappy: corrupt in...
Go
// Copyright 2011 visualfc <visualfc@gmail.com>. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "fmt" "flag" "os" "path" "bytes" ) var ( proFileName *string = flag.String("gopro", "", "make go pr...
Go
// Copyright 2011 visualfc <visualfc@gmail.com>. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "fmt" "os" "sort" "go/parser" "go/token" "go/ast" ) func GetPackage(filename string) (pakname string...
Go
// Copyright 2011 visualfc <visualfc@gmail.com>. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "fmt" "os" "io/ioutil" "bytes" "regexp" "path" "exec" "path/filepath" ) type GoProject struct { ...
Go
// Copyright 2011 visualfc <visualfc@gmail.com>. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "runtime" "os" "path" ) type GoBin struct { compiler string link string pack string cgo ...
Go
// godocview project main.go package main import ( "fmt" "flag" "runtime" "os" "path/filepath" ) var ( goroot = flag.String("goroot", runtime.GOROOT(), "Go root directory") find = flag.String("find", "", "find package list, :pkg flag is best match") list = flag.String("list", "", "Print go p...
Go
// gopkgview project godocdir.go package main import ( "fmt" "bytes" "template" "log" "io" "time" "strconv" "strings" "path/filepath" ) var ( fs FileSystem = OS // the underlying file system ) // Fake package file and name for commands. Contains the command documentation. const fakePkgF...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file defines abstract file system access. package main import ( "io" "io/ioutil" "os" ) // The FileInfo interface provides access to file informa...
Go
package main var listHTML = `<!-- Golang Package List --> <p class="detail"> Need more packages? The <a href="http://godashboard.appspot.com/package">Package Dashboard</a> provides a list of <a href="/cmd/goinstall/">goinstallable</a> packages. </p> <h2 id="Subdirectories">Subdirectories</h2> <p> {{with .D...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file contains the code dealing with package directory trees. package main import ( "bytes" "go/doc" "go/parser" "go/token" "log" "path/filepath"...
Go
package main import ( "exec" "os" "fmt" "path" "strings" ) func main() { args := os.Args[1:] if len(args) < 1 { fmt.Println("Usage: goexec [-w work_path] <program_name> [arguments...]") os.Exit(0) } var workPath string var fileName string if args[0] == "-w" { if len(args) < 3...
Go
// Copyright 2011 visualfc <visualfc@gmail.com>. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "flag" "fmt" "os" "strings" ) var ( flagInputSrc = flag.String("src", "", "input go source file") ...
Go
// Copyright 2011 visualfc <visualfc@gmail.com>. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "go/ast" "go/parser" "go/token" "os" "io" "io/ioutil" "fmt" "./doc" ) const ( tag_package ...
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Godoc comment extraction and comment -> HTML formatting. package doc import ( "go/ast" "io" "regexp" "strings" "template" // for htmlEscape ) func i...
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package doc extracts source code documentation from a Go AST. package doc import ( "go/ast" "go/token" "regexp" "sort" ) // --------------------------...
Go
// $ROOT$.go package main import ( "fmt" ) func main() { fmt.Println("Hello World!") }
Go
// $ROOT$ project main.go package main import ( "fmt" ) func main() { fmt.Println("Hello World!") }
Go
// $ROOT$ project main.go package main import ( "fmt" ) func main() { fmt.Println("Hello World!") }
Go
// $ROOT$ project doc.go /* $ROOT$ document */ package documentation
Go
// $ROOT$ project $ROOT$.go package $ROOT$
Go
// $ROOT$ project doc.go /* $ROOT$ document */ package documentation
Go
// $ROOT$ project $ROOT$.go package $ROOT$ import "C"
Go
// $ROOT$ project doc.go /* $ROOT$ document */ package documentation
Go
// $ROOT$ package package $ROOT$
Go
// $ROOT$ project doc.go /* $ROOT$ document */ package documentation
Go
// $ROOT$ project main.go package main import ( "fmt" ) func main() { fmt.Println("Hello World!") }
Go
// $ROOT$ project doc.go /* $ROOT$ document */ package documentation
Go
// Copyright 2011 The Snappy-Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package snappy implements the snappy block-based compression format. // It aims for very high speeds and reasonable compression. // // The C++ snappy ...
Go
// Copyright 2011 The Snappy-Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package snappy import ( "encoding/binary" ) // We limit how far copy back-references can go, the same as the C++ code. const maxOffset = 1 << 15 // e...
Go
// Copyright 2011 The Snappy-Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package snappy import ( "encoding/binary" "errors" ) // ErrCorrupt reports that the input is invalid. var ErrCorrupt = errors.New("snappy: corrupt in...
Go
// Go support for Protocol Buffers - Google's data interchange format // // Copyright 2010 The Go Authors. All rights reserved. // http://code.google.com/p/goprotobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // m...
Go
// Go support for Protocol Buffers - Google's data interchange format // // Copyright 2010 The Go Authors. All rights reserved. // http://code.google.com/p/goprotobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // m...
Go
// Go support for Protocol Buffers - Google's data interchange format // // Copyright 2010 The Go Authors. All rights reserved. // http://code.google.com/p/goprotobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // m...
Go
// Go support for Protocol Buffers - Google's data interchange format // // Copyright 2010 The Go Authors. All rights reserved. // http://code.google.com/p/goprotobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // m...
Go
// Go support for Protocol Buffers - Google's data interchange format // // Copyright 2011 The Go Authors. All rights reserved. // http://code.google.com/p/goprotobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // m...
Go
// Go support for Protocol Buffers - Google's data interchange format // // Copyright 2011 The Go Authors. All rights reserved. // http://code.google.com/p/goprotobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // m...
Go
// Go support for Protocol Buffers - Google's data interchange format // // Copyright 2012 The Go Authors. All rights reserved. // http://code.google.com/p/goprotobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // m...
Go
// Go support for Protocol Buffers - Google's data interchange format // // Copyright 2010 The Go Authors. All rights reserved. // http://code.google.com/p/goprotobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // m...
Go
// Go support for Protocol Buffers - Google's data interchange format // // Copyright 2010 The Go Authors. All rights reserved. // http://code.google.com/p/goprotobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // m...
Go
// Go support for Protocol Buffers - Google's data interchange format // // Copyright 2010 The Go Authors. All rights reserved. // http://code.google.com/p/goprotobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // m...
Go
// Go support for Protocol Buffers - Google's data interchange format // // Copyright 2010 The Go Authors. All rights reserved. // http://code.google.com/p/goprotobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // m...
Go
// Go support for Protocol Buffers - Google's data interchange format // // Copyright 2010 The Go Authors. All rights reserved. // http://code.google.com/p/goprotobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // m...
Go
// Go support for Protocol Buffers - Google's data interchange format // // Copyright 2010 The Go Authors. All rights reserved. // http://code.google.com/p/goprotobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // m...
Go
// Go support for Protocol Buffers - Google's data interchange format // // Copyright 2010 The Go Authors. All rights reserved. // http://code.google.com/p/goprotobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // m...
Go
// Go support for Protocol Buffers - Google's data interchange format // // Copyright 2012 The Go Authors. All rights reserved. // http://code.google.com/p/goprotobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // m...
Go
package dom /* * Comment node implementation * * Copyright (c) 2011, Jeff Schiller */ import ( "xml" ) type _comment struct { _cdata } func (c *_comment) NodeName() (s string) { return "#comment" } func newComment(token xml.Comment) (*_comment) { n := newNode(COMMENT_NODE) c := &_comment{ _cdata{n, t...
Go
package dom /* * Part of the xml/dom Go package * * Declares the interfaces from DOM Core Level 3 * http://www.w3.org/TR/DOM-Level-3-Core/ * * Copyright (c) 2009, Rob Russell * Copyright (c) 2010, Jeff Schiller */ // TODO: split this out into separate interfaces again eventually type ( // http://www.w3.or...
Go
package dom /* * Implements a very small, very non-compliant subset of the DOM Core Level 3 * http://www.w3.org/TR/DOM-Level-3-Core/ * * Copyright (c) 2009, Rob Russell * Copyright (c) 2010, Jeff Schiller */ // FIXME: we use the empty string "" to denote a 'null' value when the data type // according to the DO...
Go
package dom /* * NodeList implementations. * * Copyright (c) 2009, Rob Russell * Copyright (c) 2010, Jeff Schiller */ // A _childNodelist only stores a reference to its parent node. // This way the list can be live, each time Length() or Item is // called, fresh results are returned. type _childNodelist struct {...
Go
package dom /* * Document interface implementation * * Copyright (c) 2009, Rob Russell * Copyright (c) 2010, Jeff Schiller */ import ( "xml" "os" ) type _doc struct { *_node } func (d *_doc) NodeValue() string { return "" } func (d *_doc) AppendChild(c Node) Node { return appendChild(d,c) } func (d...
Go
package dom /* * NamedNodeMap implementations. * * Copyright (c) 2010, Jeff Schiller */ // used to return the live attributes of a node type _attrnamednodemap struct { e *_elem } func (m *_attrnamednodemap) Length() uint { return uint(len(m.e.attribs)) } func (m *_attrnamednodemap) Item(index uint) Node { ...
Go
package dom /* * CharacterData node implementation * * Copyright (c) 2009, Rob Russell * Copyright (c) 2010, Jeff Schiller * Copyright (c) 2011, Robert Johnstone */ import ( "xml" ) type _cdata struct { *_node content []byte } func (cd *_cdata) NodeName() (s string) { return "#cdata-section" } func (...
Go
package dom /* * Element implementation * * Copyright (c) 2009, Rob Russell * Copyright (c) 2010, Jeff Schiller */ import ( "xml" ) type _elem struct { *_node attribs map[string] *_attr // attributes of the element } func (e *_elem) NodeValue() string { return "" } func (e *_elem) AppendChild(c Node) ...
Go
package dom /* * Part of the xml/dom Go package * * Declares the constants used to identify various node * types. * * Copyright (c) 2011, Robert Johnstone */ const ( ELEMENT_NODE = iota + 1 ATTRIBUTE_NODE TEXT_NODE CDATA_SECTION_NODE ENTITY_REFERENCE_NODE ENTITY_NODE PROCESSING_INSTRUCTION_NODE ...
Go
package dom /* * Text node implementation * * Copyright (c) 2009, Rob Russell * Copyright (c) 2010, Jeff Schiller */ import ( "xml" ) type _text struct { _cdata } func (t *_text) NodeName() (s string) { return "#text" } func newText(token xml.CharData) (*_text) { n := newNode(TEXT_NODE) t := &_text{...
Go
package dom /* * Node implementation * * Copyright (c) 2009, Rob Russell * Copyright (c) 2010, Jeff Schiller */ // TODO: think about how to make this class a bit more generic to promote extensibility // (for instance, this class has to know about Attr, Element and Document types to // implement Node...
Go
package dom /* * Attr implementation * * Copyright (c) 2010, Jeff Schiller */ import "xml" type _attr struct { *_node value string // value (for attr) ownerElement *_elem } func (a *_attr) NodeValue() string { return a.value } func (a *_attr) AppendChild(n Node) Node { return n } func (a *_attr) RemoveC...
Go
// Copyright (C) 2010, Kyle Lemons <kyle@kylelemons.net>. All rights reserved. package log4go import ( "io" "os" "fmt" ) var stdout io.Writer = os.Stdout // This is the standard writer that prints to standard output. type ConsoleLogWriter chan *LogRecord // This creates a new ConsoleLogWriter func NewConsoleLo...
Go
// Copyright (C) 2010, Kyle Lemons <kyle@kylelemons.net>. All rights reserved. package log4go import ( "fmt" "bytes" "io" ) const ( FORMAT_DEFAULT = "[%D %T] [%L] (%S) %M" FORMAT_SHORT = "[%t %d] [%L] %M" FORMAT_ABBREV = "[%L] %M" ) type formatCacheType struct { LastUpdateSeconds int64 shortTime, sho...
Go
// Copyright (C) 2010, Kyle Lemons <kyle@kylelemons.net>. All rights reserved. package log4go import ( "errors" "os" "fmt" "strings" ) var ( Global Logger ) func init() { Global = NewDefaultLogger(DEBUG) } // Wrapper for (*Logger).LoadConfiguration func LoadConfiguration(filename string) { Global.LoadConfi...
Go
// Copyright (C) 2010, Kyle Lemons <kyle@kylelemons.net>. All rights reserved. package log4go import ( "os" "fmt" "time" ) // This log writer sends output to a file type FileLogWriter struct { rec chan *LogRecord rot chan bool // The opened file filename string file *os.File // The logging format fo...
Go
// Copyright (C) 2010, Kyle Lemons <kyle@kylelemons.net>. All rights reserved. package log4go import ( "encoding/xml" "fmt" "io/ioutil" "os" "strconv" "strings" ) type xmlProperty struct { Name string `xml:"name,attr"` Value string `xml:",chardata"` } type xmlFilter struct { Enabled string `xml:"...
Go
// Copyright (C) 2010, Kyle Lemons <kyle@kylelemons.net>. All rights reserved. // Package log4go provides level-based and highly configurable logging. // // Enhanced Logging // // This is inspired by the logging functionality in Java. Essentially, you create a Logger // object and create output filters for it. You ...
Go
package main import ( "flag" "fmt" "net" "os" ) var ( port = flag.String("p", "12124", "Port number to listen on") ) func e(err error) { if err != nil { fmt.Printf("Erroring out: %s\n", err) os.Exit(1) } } func main() { flag.Parse() // Bind to the port bind, err := net.ResolveUDPAddr("0.0.0.0:" + *po...
Go
package main import ( "time" ) import l4g "code.google.com/p/log4go" func main() { log := l4g.NewLogger() log.AddFilter("stdout", l4g.DEBUG, l4g.NewConsoleLogWriter()) log.Info("The time is now: %s", time.Now().Format("15:04:05 MST 2006/01/02")) }
Go
package main import ( "time" ) import l4g "code.google.com/p/log4go" func main() { log := l4g.NewLogger() log.AddFilter("network", l4g.FINEST, l4g.NewSocketLogWriter("udp", "192.168.1.255:12124")) // Run `nc -u -l -p 12124` or similar before you run this to see the following message log.Info("The time is now: ...
Go