From 034a2a5a5e92d7264ec7558d20f4d7746506ee8f Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Sat, 12 Jan 2013 12:06:59 -0600 Subject: Implement support for unqiue config instances. This commit adds a new type, SpewState, which can be used to create instances with unique configuration options. The methods of SpewState are equivalent to the top-level functions. Full documentation and examples are included. --- spew/doc.go | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'spew/doc.go') diff --git a/spew/doc.go b/spew/doc.go index 61c0091..94db62d 100644 --- a/spew/doc.go +++ b/spew/doc.go @@ -58,20 +58,29 @@ printing style, use the convenience wrappers Printf, Fprintf, etc with either Configuration Options +Configuration of spew is handled by fields in the ConfigState type. For +convenience, all of the top-level functions use a global state available +via the spew.Config global. + +It is also possible to create a SpewState instance which provides a unique +ConfigState accessible via the Config method. The methods of SpewState are +equivalent to the top-level functions. This allows concurrent configuration +options. See the SpewState documentation for more details. + The following configuration options are available: - spew.Config.MaxDepth + * MaxDepth Maximum number of levels to descend into nested data structures. There is no limit by default. - spew.Config.Indent + * Indent String to use for each indentation level for Dump functions. It is a single space by default. A popular alternative is "\t". - spew.Config.DisableMethods + * DisableMethods Disables invocation of error and Stringer interface methods. Method invocation is enabled by default. - spew.Config.DisablePointerMethods + * DisablePointerMethods Disables invocation of error and Stringer interface methods on types which only accept pointer receivers from non-pointer variables. Pointer method invocation is enabled by default. -- cgit v1.2.3