Ejemplo n.º 1
0
        /// <summary>
        /// Enrich log events with an AssemblyVersion property containing the current <see cref="AssemblyInformationalVersionAttribute.InformationalVersion"/> from the assembly of T.
        /// </summary>
        /// <param name="enrichmentConfiguration">Logger enrichment configuration.</param>
        /// <returns>Configuration object allowing method chaining.</returns>
        public static LoggerConfiguration WithAssemblyInformationalVersion <T>(this LoggerEnrichmentConfiguration enrichmentConfiguration)
        {
            var assembly = typeof(T).Assembly;

            return(enrichmentConfiguration.WithAssemblyInformationalVersion(assembly));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Enrich log events with an AssemblyVersion property containing the current <see cref="AssemblyInformationalVersionAttribute.InformationalVersion"/> from the assembly.
        /// </summary>
        /// <param name="enrichmentConfiguration">Logger enrichment configuration.</param>
        /// <returns>Configuration object allowing method chaining.</returns>
        public static LoggerConfiguration WithAssemblyInformationalVersion(this LoggerEnrichmentConfiguration enrichmentConfiguration)
        {
            var assembly = Assembly.GetEntryAssembly() ?? Assembly.GetCallingAssembly();

            return(enrichmentConfiguration.WithAssemblyInformationalVersion(assembly));
        }