Git Product home page Git Product logo

spiffy's Introduction

Overview

๐Ÿ‘‹ Hi, I'm Chris. I've been writing software for the last few decades.

Lately, I've been working on:

a PowerShell wrapper around GitLab API

I use the GitlabCli module for performing various tasks that would otherwise be difficult/tedious (e.g. cloning all the projects in a group). My favorite part of using this module is that it has implicit context based on your working directory making it easy to jump back and forth between local code artifacts and remote API resources. You can invoke APIs, or simply pipe any object to | go to navigate to the Web UI, e.g. mr | go brings you to the Merge Request UI for your current branch.

Give it a try here

Other Projects

I've created and actively maintain a few projects, including

Contributions to OSS

I've made a few (small) contributions to various projects that I've used throughtout the years, including:

spiffy's People

Contributors

andyalm avatar chris-peterson avatar chrissimmons avatar smarts avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

spiffy's Issues

6.1

Proposed feature-set for 6.1:

  • Set(key, val, Condition.IfNotExists)
  • Ditch custom synchronization code in favor of built-in concurrent collections

Difference between step method and `Step` class

Method steps support overloads while subclasses of Kekiri.Step do not support constructor overloads. It would be nice if both types of steps worked the same way (either neither supporting overloads, or both supporting overloads). I'd vote for both supporting overloads. What do you think @chris-peterson ?

Include option for serializing a structure

This can currently be achieved by:

    {
        public static EventContext IncludeStructure(this EventContext eventContext, object structure, string keyPrefix = null, bool includeNullValues = true)
        {
            if (structure != null)
            {
                foreach (var property in from property in structure.GetType().GetProperties().Where(p => p.CanRead)
                                         let sensitiveDataAttribyte = property
                                                                          .GetCustomAttributes(typeof (SensitiveDataAttribute), false)
                                                                          .FirstOrDefault() as SensitiveDataAttribute
                                         where sensitiveDataAttribyte == null
                                         select property)
                {
                    try
                    {
                        var val = property.GetValue(structure, null);
                        if (val == null && !includeNullValues)
                        {
                            continue;
                        }
                        string key = string.IsNullOrEmpty(keyPrefix)
                                         ? property.Name
                                         : string.Format("{0}_{1}", keyPrefix, property.Name);
                        eventContext[key] = val;
                    }
                    catch // intentionally squashed
                    {
                    }
                }
            }

            return eventContext;
        }
    }```

Splunk wants comma separted field in quotes.

It looks like only the Message field surrounds the value with double quotes. That can be a problem on multi-value fields in splunk.

For example
context["ImportantStuff"] = string.Join(",", arrayOfGoodies) ;

For splunk, I have to change this to
context["ImportantStuff"] = "\"" + string.Join(",", arrayOfGoodies) + "\"";

Don't forget NOT to add quotes if they're already there.

Sorry I couldn't do this myself.

Support "informational" exceptions

Problem

EventContext.IncludeException automatically sets Level=Error. Most of the time, this is desirable, but there are times when it is not (e.g. you've handled an exception, but still want to log details).

Implementation Suggestion

EventContext.IncludeInformationalException that would require a string key, and exception value.

Allow sub-classification of Operation

Sometimes, a given method will have need to create EventContext in different circumstances, e.g. error handling.

Provide a convenience method EventContext.AppendOperation.

Example:

   void DoStuff() {
     using (var normalContext = new EventContext()) {
       // do normal stuff
     }

     if (errorsDetected) {   
        using (var errorContext = new EventContext()) {
          errorContext.AppendOperation(":HandleErrors");
      }
   }
}

errorContext would publish an event with Operation=DoStuff:HandleErrors

Feature: Add ability to suppress logging of individual properties

When using IncludeStructure, it would be nice to be able to deny certain fields from getting logged. e.g.

class Customer
{
   public string Name { get; set; }
   
   [NeverLog]
   public CreditCardNumber { get; set; }
}

Use "duck" typing to allow client to define the attribute in their own code base.

Introduce prioritization for short log values

In a situation where a log is overlong and the underlying log capture ssystem is forced to cut off the log, prioritizing "short" values in favor of "long" ones will maximize the count of KV pairs that are included in the log message.

Addressed by #26

NLog.Config file ignored

I created an NLog.config file for an app, but it is completely ignored. The only way to configure spiffy appears to be the Initialize(Action<NLogConfigurationApi>) method.

Default behavior of Console is strange for the library usecase

Scenario

A library package Foo periodically does something "notable". The application developers for Foo want to generate event messages to provide visibility to code that would otherwise be invisible. Spiffy.Monitoring seems like a good fit.

An application named Bar discovers Foo. The application developers for Bar are too busy (reckless?) to be concerned with "logging". When running Bar, they are confused by periodic log emission as Foo performs its duties.

Proposed Change

Remove default publishing behavior, require application entry-point to Initialize either a provider assembly, or one of the built-ins ("trace" / "console").

Planning Version 7

Potential Changes in v7.0

Breaking Changes

  • default to shorter, snake_case field names. Provide configuration options to retain existing behavior and/or further customize field naming
  • changes to default behavior: RemoveNewLines: true
  • don't log Count_ automatically when using Time/Timers.Accumulate -- require some sort of opt-in
  • default precision for ms is whole numbers only. can opt-in for fractional values

Enhancements

  • Add ability to control precision for timings -- with this provide a minimum threshold under which fields are automatically suppressed
  • Ensure non-standard SI units are explicit in field names, e.g. ms in TimeElapsed
  • Add Warn/Error methods that default to appending. Consider removing SetToX methods
  • Introduce a concept of "essential fields". This set can be extended by callers and is used by a new Summarize() method that will shrink a logged message to just the essential fields. This is useful to manage logging volumes, e.g. for a web request that is fast and successful, don't log a ton of granular timings, etc; but rather, the "essential fields"

Feature: IncludeJson

Add an IncludeJson method

While JSON is a pretty human-infriendly representation of log data, there are times when you might want to emit JSON as part of a log entry (e.g. debugging corner cases)

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.