AnayaRojoTools 2.0.0

Anaya Rojo Tools

Tools for c# development

Install-Package AnayaRojoTools -Version 2.0.0
dotnet add package AnayaRojoTools --version 2.0.0
<PackageReference Include="AnayaRojoTools" Version="2.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AnayaRojoTools --version 2.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Anaya Rojo Tools

Nuget installation:
Install-Package AnayaRojoTools -Version 2.0.0
Configuración de ejemplo para el uso básico de la configuración:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <connectionStrings>
    <add name="Connection" connectionString=""/>
  </connectionStrings>
  <appSettings>
    <add key="string" value="string"></add>
    <add key="char" value="c"></add>
    <add key="int" value="1"></add>
    <add key="long" value="123456789"></add>
    <add key="float" value="1.5"></add>
    <add key="double" value="1.5"></add>
    <add key="decimal" value="1.5"></add>
    <add key="date" value="13/12/2017"></add>
    <add key="bool" value="True"></add>
    <add key="enum" value="ENUM_A"></add>
  </appSettings>
</configuration>
Uso básico de la configuración:
using System;
using AnayaRojo.Tools.Configs;

public class Program
{
  public static void Main()
  {
    string lStrValue = Config.GetValue<string>("string");
    char lChrValue = Config.GetValue<char>("char");
    int lIntValue = Config.GetValue<int>("int");
    long lLonValue = Config.GetValue<long>("long");
    float lFltValue = Config.GetValue<float>("float");
    double lFltValue = Config.GetValue<double>("double");
    decimal lDmlValue = Config.GetValue<decimal>("decimal");
    DateTime lDtmValue = Config.GetValue<DateTime>("date");
    bool lBolValue = Config.GetValue<bool>("bool");
    SampleEnum lEnmValue = Config.GetValue<SampleEnum>("enum");
  }
}

public enum SampleEnum
{
    ENUM_A,
    ENUM_B,
    ENUM_C
}
Configuración del log:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
      <section name="logsConfiguration" type="AnayaRojo.Tools.Configs.Sections.LogsSection, AnayaRojo.Tools" />
    </configSections>
    <logsConfiguration>
      <visibility
        showInfo="true"
        showSuccess="true"
        showTracking="true"
        showProcess="true"
        showWarning="true"
        showError="true"
        showException="true">
      </visibility>
      <log
        format="{date} [{type}] {message}"
        dateFormat="yyyy-MM-dd HH:mm:ss"
        active="true"
        webLog="false"
        fullLog="false"
        multiFiles="false"
        fileName="AppLog"
        relativePath="false"
        path="">
      </log>
  </logsConfiguration>
</configuration>
Uso básico del log:
using System;
using AnayaRojo.Tools.Logs;
using AnayaRojo.Tools.Logs.Enums;

public class Program
{
  public static void Main()
  {
    //Default log
    Log.Write("Log test");

    //Write by type
    Log.Write(LogTypeEnum.SUCCESS, "Success log");
    Log.Write(LogTypeEnum.INFO, "Info log");
    Log.Write(LogTypeEnum.PROCESS, "Process log");
    Log.Write(LogTypeEnum.TRACKING, "Tracking log");
    Log.Write(LogTypeEnum.WARNING, "Warning log");
    Log.Write(LogTypeEnum.ERROR, "Error log");
    Log.Write(LogTypeEnum.EXCEPTION, "Exception log");

    //Write with format
    Log.Write(LogTypeEnum.INFO, "Format of the log {0}", "AnayaRojo");

    //Write exception
    Log.Write(new Exception("Log exception"));
  }
}

See code on GitHub

Anaya Rojo Tools

Nuget installation:
Install-Package AnayaRojoTools -Version 2.0.0
Configuración de ejemplo para el uso básico de la configuración:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <connectionStrings>
    <add name="Connection" connectionString=""/>
  </connectionStrings>
  <appSettings>
    <add key="string" value="string"></add>
    <add key="char" value="c"></add>
    <add key="int" value="1"></add>
    <add key="long" value="123456789"></add>
    <add key="float" value="1.5"></add>
    <add key="double" value="1.5"></add>
    <add key="decimal" value="1.5"></add>
    <add key="date" value="13/12/2017"></add>
    <add key="bool" value="True"></add>
    <add key="enum" value="ENUM_A"></add>
  </appSettings>
</configuration>
Uso básico de la configuración:
using System;
using AnayaRojo.Tools.Configs;

public class Program
{
  public static void Main()
  {
    string lStrValue = Config.GetValue<string>("string");
    char lChrValue = Config.GetValue<char>("char");
    int lIntValue = Config.GetValue<int>("int");
    long lLonValue = Config.GetValue<long>("long");
    float lFltValue = Config.GetValue<float>("float");
    double lFltValue = Config.GetValue<double>("double");
    decimal lDmlValue = Config.GetValue<decimal>("decimal");
    DateTime lDtmValue = Config.GetValue<DateTime>("date");
    bool lBolValue = Config.GetValue<bool>("bool");
    SampleEnum lEnmValue = Config.GetValue<SampleEnum>("enum");
  }
}

public enum SampleEnum
{
    ENUM_A,
    ENUM_B,
    ENUM_C
}
Configuración del log:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
      <section name="logsConfiguration" type="AnayaRojo.Tools.Configs.Sections.LogsSection, AnayaRojo.Tools" />
    </configSections>
    <logsConfiguration>
      <visibility
        showInfo="true"
        showSuccess="true"
        showTracking="true"
        showProcess="true"
        showWarning="true"
        showError="true"
        showException="true">
      </visibility>
      <log
        format="{date} [{type}] {message}"
        dateFormat="yyyy-MM-dd HH:mm:ss"
        active="true"
        webLog="false"
        fullLog="false"
        multiFiles="false"
        fileName="AppLog"
        relativePath="false"
        path="">
      </log>
  </logsConfiguration>
</configuration>
Uso básico del log:
using System;
using AnayaRojo.Tools.Logs;
using AnayaRojo.Tools.Logs.Enums;

public class Program
{
  public static void Main()
  {
    //Default log
    Log.Write("Log test");

    //Write by type
    Log.Write(LogTypeEnum.SUCCESS, "Success log");
    Log.Write(LogTypeEnum.INFO, "Info log");
    Log.Write(LogTypeEnum.PROCESS, "Process log");
    Log.Write(LogTypeEnum.TRACKING, "Tracking log");
    Log.Write(LogTypeEnum.WARNING, "Warning log");
    Log.Write(LogTypeEnum.ERROR, "Error log");
    Log.Write(LogTypeEnum.EXCEPTION, "Exception log");

    //Write with format
    Log.Write(LogTypeEnum.INFO, "Format of the log {0}", "AnayaRojo");

    //Write exception
    Log.Write(new Exception("Log exception"));
  }
}

See code on GitHub

Release Notes

Configuration, Log and code extensions

Dependencies

This package has no dependencies.

Version History

Version Downloads Last updated
2.0.0 186 6/10/2018
1.0.0 195 5/2/2018