logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class LoggingProfileCreator

    Generates (or updates) the assets the Logging aggregate needs to boot with a working default logger: the UnityConsoleLogSettings sink, the UnityFileLogSettings sink, the optional UnityStructuredLogSettings sink (plus its shared backend asset, authored through the same StructuredBackendAuthoringFactory engine GameSave/GameProgress use), and a UnityLogProfile wired to whichever sink(s) are enabled. Today the only tool that creates any of these is the one-shot Setup Assistant (console/file settings only, via generic recipe assets) — this is the first dedicated creation wizard for the aggregate, and the first ever for UnityLogProfile, which otherwise has no authoring tool at all.

    Resolution differs per asset, matching how the runtime actually discovers each one: UnityConsoleLogInstaller/Serenity.EventDispatcher.Installation.Installers.UnityFileLogInstaller each fall back to UnityAssetUtils.LoadAllFromAnyBlocking<T> over the module:logging label and use the first match — so the two sink settings are project-wide singletons (ambiguity is a warning, never an error), resolved the same way Serenity.SystemConfiguration.Infrastructure.Editor.Builder.SystemConfigurationSettingsCreator resolves its own settings asset, through the shared SettingsAssetAuthoring engine. UnityStructuredLogSettings resolves the SAME way while the composition root's StructuredLogSettings list is empty — UnitySerenityInstaller.InstallStructuredLogService then runs the same zero-config Addressables-label pass — so this wizard authors it with the identical singleton-resolution/ambiguity-warning behavior as Console/File, even though the runtime also supports N structured instances once the list is populated by hand. UnityLogProfile is different: UnitySerenityInstaller.LogProfile is assigned directly on the composition root, and the shipped project already carries two of them side by side (EditorLogProfile, StandaloneLogProfile) — so a profile resolves by Id within OutputFolderPath, the same by-Id-in-folder pattern Serenity.AssetPrefetcher.Infrastructure.Editor.Builder.PrefetchPolicyCreator uses for its N PrefetchPolicyProfile rows.

    DefaultLoggerKey uses the literal "console"/"file"/"structured"(:"{Id}") keys, not an assembly-qualified type name — even though the two profiles shipped with the project (EditorLogProfile, StandaloneLogProfile) use AQN strings. UnitySerenityInstaller.GetLogServiceFromKeyOrTypeName recognizes all of them directly, but a literal key survives a class rename or namespace move that would silently break an AQN-based profile; a wizard-authored profile should not carry a value that can bit-rot.

    CreateLoggingProfileWindow only collects input and renders results; every asset mutation lives here.
    Inheritance
    object
    LoggingProfileCreator
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.Logging.Infrastructure.Editor.Builder
    Assembly: Serenity.UnityLogging.Infrastructure.Editor.dll
    Syntax
    public static class LoggingProfileCreator

    Fields

    ConsoleLoggerKey

    The literal keys UnitySerenityInstaller.GetLogServiceFromKeyOrTypeName recognizes directly — see the type doc for why this wizard prefers them over an AQN string.

    Declaration
    public const string ConsoleLoggerKey = "console"
    Field Value
    Type Description
    string

    DefaultStructuredLocalFileDirectoryName

    Default LocalFile backend directory name for a structured sink's backend, matching StructuredLogBackendFactory's own runtime fallback directory.

    Declaration
    public const string DefaultStructuredLocalFileDirectoryName = "logs"
    Field Value
    Type Description
    string

    DefaultStructuredSqliteDatabaseFileName

    Default Sqlite backend database file name for a structured sink's backend, matching StructuredLogBackendFactory's own runtime fallback database file.

    Declaration
    public const string DefaultStructuredSqliteDatabaseFileName = "logs.db"
    Field Value
    Type Description
    string

    FileLoggerKey

    Declaration
    public const string FileLoggerKey = "file"
    Field Value
    Type Description
    string

    StructuredLoggerKey

    The bare structured logger key — only unambiguous while exactly one structured sink instance is installed. See StructuredLogSinkResolver for the multi-instance rules and the structured:{Id} instance-key syntax this wizard also authors via StructuredSettingsId.

    Declaration
    public const string StructuredLoggerKey = "structured"
    Field Value
    Type Description
    string

    Methods

    Create(Input)

    Validates the request, then resolves-or-creates the console sink, the file sink, and the profile, applying every field. On any failure every mutation across all three assets is rolled back: created assets/folders are deleted, their Addressables entries removed, and any already-existing asset that was being edited has its pre-call field values restored.

    Declaration
    public static LoggingProfileCreator.Result Create(LoggingProfileCreator.Input input)
    Parameters
    Type Name Description
    LoggingProfileCreator.Input input
    Returns
    Type Description
    LoggingProfileCreator.Result

    Validate(Input)

    Validates the request: a non-empty ProfileId, at least one sink enabled (a profile with every sink disabled resolves to no logger at all at boot), the chosen DefaultLogger must be one of the enabled sinks, the file sink's FileLogFileName must be a bare, valid file name (never a path — it is appended directly to IPathService.GetUserDataDir()), a well-formed output folder, and the same resolve-or-edit ambiguity/overwrite warnings Create(Input) would act on.

    Declaration
    public static SerenityCreationValidationResult Validate(LoggingProfileCreator.Input input)
    Parameters
    Type Name Description
    LoggingProfileCreator.Input input
    Returns
    Type Description
    SerenityCreationValidationResult
    In this article
    © 2026 Serenity. All Rights Reserved