Ejemplo n.º 1
0
        /// <summary>
        /// Enrich log events with an AssemblyVersion property containing the current <see cref="AssemblyName.Version"/> of T.
        /// </summary>
        /// <param name="enrichmentConfiguration">Logger enrichment configuration.</param>
        /// <param name="useSemVer">Use semantic versioning.</param>
        /// <returns>Configuration object allowing method chaining.</returns>
        public static LoggerConfiguration WithAssemblyVersion <T>(this LoggerEnrichmentConfiguration enrichmentConfiguration, bool useSemVer = false)
        {
            var assembly = typeof(T).Assembly;

            return(enrichmentConfiguration.WithAssemblyVersion(assembly, useSemVer));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Enrich log events with an AssemblyVersion property containing the current <see cref="AssemblyName.Version"/>.
        /// </summary>
        /// <param name="enrichmentConfiguration">Logger enrichment configuration.</param>
        /// <param name="useSemVer">Use semantic versioning.</param>
        /// <returns>Configuration object allowing method chaining.</returns>
        public static LoggerConfiguration WithAssemblyVersion(this LoggerEnrichmentConfiguration enrichmentConfiguration, bool useSemVer = false)
        {
            var assembly = Assembly.GetEntryAssembly() ?? Assembly.GetCallingAssembly();

            return(enrichmentConfiguration.WithAssemblyVersion(assembly, useSemVer));
        }