Update actions/attest-build-provenance action to v1.3.1
[ArchiSteamFarm.git] / ArchiSteamFarm / Core / Debugging.cs
blob52a1792eab5115955bc01c8df334391f84973bbf
1 // ----------------------------------------------------------------------------------------------
2 // _ _ _ ____ _ _____
3 // / \ _ __ ___ | |__ (_)/ ___| | |_ ___ __ _ _ __ ___ | ___|__ _ _ __ _ __ ___
4 // / _ \ | '__|/ __|| '_ \ | |\___ \ | __|/ _ \ / _` || '_ ` _ \ | |_ / _` || '__|| '_ ` _ \
5 // / ___ \ | | | (__ | | | || | ___) || |_| __/| (_| || | | | | || _|| (_| || | | | | | | |
6 // /_/ \_\|_| \___||_| |_||_||____/ \__|\___| \__,_||_| |_| |_||_| \__,_||_| |_| |_| |_|
7 // ----------------------------------------------------------------------------------------------
8 // |
9 // Copyright 2015-2024 Ɓukasz "JustArchi" Domeradzki
10 // Contact: JustArchi@JustArchi.net
11 // |
12 // Licensed under the Apache License, Version 2.0 (the "License");
13 // you may not use this file except in compliance with the License.
14 // You may obtain a copy of the License at
15 // |
16 // http://www.apache.org/licenses/LICENSE-2.0
17 // |
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the License is distributed on an "AS IS" BASIS,
20 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 // See the License for the specific language governing permissions and
22 // limitations under the License.
24 using System;
25 using ArchiSteamFarm.Storage;
26 using SteamKit2;
28 namespace ArchiSteamFarm.Core;
30 internal static class Debugging {
31 #if DEBUG
32 internal static bool IsDebugBuild => true;
33 #else
34 internal static bool IsDebugBuild => false;
35 #endif
37 internal static bool IsDebugConfigured => ASF.GlobalConfig?.Debug ?? GlobalConfig.DefaultDebug;
39 internal static bool IsUserDebugging => IsDebugBuild || IsDebugConfigured;
41 internal sealed class DebugListener : IDebugListener {
42 public void WriteLine(string category, string msg) {
43 if (string.IsNullOrEmpty(category) && string.IsNullOrEmpty(msg)) {
44 throw new InvalidOperationException($"{nameof(category)} && {nameof(msg)}");
47 ASF.ArchiLogger.LogGenericDebug($"{category} | {msg}");