Giter Site home page Giter Site logo

toolbox's Introduction

The Toolbox is a .NET 4 Framework utility library that provides:

  • A collection of extensions to the standard framework namespaces and classes
  • A basic logging framework with tag-based console logging available

Usage

Just search for Toolbox in the NuGet repository or visit the page here. Alternatively, visit the Releases section.

Framework

Extensions

  • System.Collections.Generic.TCollections : Safe methods for getting values from dictionaries without exceptions, adding ranges to sets and case-insensitive string contains
  • System.TConsole : Thread-safe extra writing functions for the Console, mainly in color
  • System.TDateTime : Extensions for quickly determining seconds-until-now and unix timestamps
  • System.TEnums : Syntactic sugar for enum parsing
  • System.TMath : Methods for clamping numbers
  • System.TRandom : Methods for quickly accessing psuedo-random data from a static instance of Random
  • System.Text.RegularExpressions.TRegex : Shortcut methods for case-insensitive regex matching/replacements and try methods
  • System.TString : Methods for cleaner string splits, mapping, case-insensitive equality checking and syntactic sugar for formatting

Logging

Top-level

  • System.Log : Global logging channel methods, including one for each log level and a QuickSetup for console logging. Also has extensions for quick-logging exceptions.
  • System.LogChannel : Represents a "channel" where logging messages can be sent to and loggers attached for handling those messages
  • System.LogLevels : Flag enum of logging levels supported by this framework, including combination flags

Loggers

  • System.Loggers.ILogger : Interface for implementing a log handler
  • System.Loggers.ConsoleLogger : Basic handler for outputting log messages to console, with varying colors based on log level. Can be paused, with automatic printout of backlog when unpaused
  • System.Loggers.FileLogger : Basic handler for outputting log messages to files in UTF-8 encoding which can be paused

Examples

Logging

/// Quick start example with console-logger and all logging levels
Log.QuickSetup();
Log.Info("Application", "Hello, world!");
/// Quick start for debugging/production code
#if DEBUG
Log.QuickSetup(LogLevels.Debugging);
#else
Log.QuickSetup(LogLevels.Production);
#endif

Log.Info("Application", "Hello, world!");
/// Multiple loggers
Log.Attach( new ConsoleLogger() );
Log.Attach( new FileLogger("Log.txt") );
Log.Info("Application", "Hello, world!");

toolbox's People

Contributors

roycurtis avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

szliyang

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.