Code Monkey home page Code Monkey logo

dynamicscrm-crmlogger's Introduction

DynamicsCrm-CrmLogger

Join the chat at https://gitter.im/yagasoft/DynamicsCrm-CrmLogger

Version: 3.1.1.1


A CRM solution that provides a lot of details when logging from plugins, web-services, and console apps. It provides a tree view of function calls as well.

Features

  • Log each whole execution in its own record
    • Log works in plugins, custom steps, console apps, and web services
  • Defers log to the end of the execution for improved performance
  • Create parent log container and defers creating entries to the async job for performance
  • Option for logging function start and end (manually)
    • For automatic logging, use CrmLogger.Fody from NuGet
  • Automatically parses the exception details on passing an Exception object to the log
  • Logs to CRM, CSV file, or console
    • File logging can be used as a fallback
  • Log files overflow to new files on date or size threshold

Guide

  • Set the log level in the Generic Configuration entity, on the 'Logging' form
  • Go to the Log entity view to view the logs

I will post a complete guide soon.

The following is a sample of how to log in a plugin.

public void Execute(IServiceProvider serviceProvider)
{
	var context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
	
	try
	{
		log.SetRegarding(context.PrimaryEntityName, context.PrimaryEntityId);
		log.LogExecutionStart();

		log.LogDebug("Starting plugin logic ...");

		log.Log("Some info.");
		Test(log);
		log.LogWarning("Some warning.");

		log.LogDebug("Finished plugin logic.");
	}
	catch (Exception e)
	{
		log.ExecutionFailed();
		log.Log(e, context);

		throw new InvalidPluginExecutionException(e.Message, e);
	}
	finally
	{
		log.LogExecutionEnd();
	}
}

private void Test(CrmLog log)
{
	log.LogFunctionStart();

	try
	{
		log.Log("Some info.");
	}
	catch (Exception e)
	{
		log.Log(e);
		throw;
	}
	finally
	{
		log.LogFunctionEnd();
	}
}

CrmLog class can be found in either Common.cs in the DynamicsCrm-Libraries repository (for plugins), or LinkDev.Libraries on NuGet (for web/console apps).

Dependencies

Changes

v3.1.1.1 (2019-02-27)

  • Changed: moved to a new namespace

v2.1.1.1 (2018-09-05)

  • Added: processing plugin
  • Changed: cleaned the project of obsolete components

Copyright © by Ahmed Elsawalhy (Yagasoft) -- GPL v3 Licence

dynamicscrm-crmlogger's People

Contributors

yagasoft avatar ahmedelsawalhy avatar gitter-badger avatar

Watchers

James Cloos avatar

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.