/* * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or * its licensors. * * For complete copyright and license terms please see the LICENSE at the root of this * distribution (the "License"). All use of this software is governed by the License, * or, if provided, by the license below or the license accompanying this file. Do not * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * */ #pragma once #include #include namespace AssetProcessor { struct JobDiagnosticInfo { JobDiagnosticInfo() = default; JobDiagnosticInfo(AZ::u32 warningCount, AZ::u32 errorCount) : m_warningCount(warningCount), m_errorCount(errorCount) {} bool operator==(const JobDiagnosticInfo& rhs) const; bool operator!=(const JobDiagnosticInfo& rhs) const; AZ::u32 m_warningCount = 0; AZ::u32 m_errorCount = 0; }; enum class WarningLevel : AZ::u8 { Default = 0, FatalErrors, FatalErrorsAndWarnings }; class JobDiagnosticRequests : public AZ::EBusTraits { public: static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single; static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single; typedef AZStd::recursive_mutex MutexType; virtual JobDiagnosticInfo GetDiagnosticInfo(AZ::u64 jobRunKey) const = 0; virtual void RecordDiagnosticInfo(AZ::u64 jobRunKey, JobDiagnosticInfo info) = 0; virtual WarningLevel GetWarningLevel() const = 0; virtual void SetWarningLevel(WarningLevel level) = 0; }; using JobDiagnosticRequestBus = AZ::EBus; class JobDiagnosticTracker : public JobDiagnosticRequestBus::Handler { public: JobDiagnosticTracker(); ~JobDiagnosticTracker(); JobDiagnosticInfo GetDiagnosticInfo(AZ::u64 jobRunKey) const override; void RecordDiagnosticInfo(AZ::u64 jobRunKey, JobDiagnosticInfo info) override; WarningLevel GetWarningLevel() const override; void SetWarningLevel(WarningLevel level) override; WarningLevel m_warningLevel = WarningLevel::Default; AZStd::unordered_map m_jobInfo; }; } // namespace AssetProcessor