aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGravatar Sadie Powell2025-03-29 04:31:31 +0000
committerGravatar Sadie Powell2025-03-29 04:33:29 +0000
commit8b5bccaa8c382cca1dfae3c985e6045f1c367e1f (patch)
tree7161d8e2912031c7cc48e2c81cee8c2aa590c54f /include
parentRemove support for in-query password comparison in sqlauth. (diff)
parentRelease v4.7.0. (diff)
Merge branch 'insp4' into master.
Diffstat (limited to 'include')
-rw-r--r--include/exception.h2
-rw-r--r--include/logging.h10
-rw-r--r--include/modules/httpd.h2
-rw-r--r--include/modules/regex.h2
-rw-r--r--include/timeutils.h12
5 files changed, 24 insertions, 4 deletions
diff --git a/include/exception.h b/include/exception.h
index 702d3aa09..017bb64df 100644
--- a/include/exception.h
+++ b/include/exception.h
@@ -1,7 +1,7 @@
/*
* InspIRCd -- Internet Relay Chat Daemon
*
- * Copyright (C) 2022 Sadie Powell <sadie@witchery.services>
+ * Copyright (C) 2022, 2025 Sadie Powell <sadie@witchery.services>
*
* This file is part of InspIRCd. InspIRCd is free software: you can
* redistribute it and/or modify it under the terms of the GNU General Public
diff --git a/include/logging.h b/include/logging.h
index 96aec1ea5..4e29c19c8 100644
--- a/include/logging.h
+++ b/include/logging.h
@@ -261,7 +261,15 @@ private:
if (maxlevel < level && !caching)
return; // No loggers care about this message.
- Write(level, type, FMT::vformat(format, FMT::make_format_args(args...)));
+ try
+ {
+ Write(level, type, FMT::vformat(format, fmt::make_format_args(args...)));
+ }
+ catch (const FMT::format_error& err)
+ {
+ // This should only ever happen when we encounter a bug.
+ Write(Log::Level::CRITICAL, "LOG", "BUG: failed to format a log message: {} -- {}", format, err.what());
+ }
}
public:
diff --git a/include/modules/httpd.h b/include/modules/httpd.h
index c590746c7..2144273ff 100644
--- a/include/modules/httpd.h
+++ b/include/modules/httpd.h
@@ -2,7 +2,7 @@
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2019 linuxdaemon <linuxdaemon.irc@gmail.com>
- * Copyright (C) 2013, 2021-2023 Sadie Powell <sadie@witchery.services>
+ * Copyright (C) 2013, 2021-2023, 2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2013, 2015 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2012 Robby <robby@chatbelgie.be>
* Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
diff --git a/include/modules/regex.h b/include/modules/regex.h
index 6bf912f3d..88b5a39be 100644
--- a/include/modules/regex.h
+++ b/include/modules/regex.h
@@ -1,7 +1,7 @@
/*
* InspIRCd -- Internet Relay Chat Daemon
*
- * Copyright (C) 2013, 2020-2023 Sadie Powell <sadie@witchery.services>
+ * Copyright (C) 2013, 2020-2023, 2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2012 Robby <robby@chatbelgie.be>
* Copyright (C) 2008 Thomas Stagner <aquanight@gmail.com>
*
diff --git a/include/timeutils.h b/include/timeutils.h
index 5ac185e22..dd6585cfb 100644
--- a/include/timeutils.h
+++ b/include/timeutils.h
@@ -74,6 +74,18 @@ namespace Duration
namespace Time
{
+ /** A short time format picked for being readable (e.g. "Sun 23 Mar 2025 10:20:30") */
+ inline constexpr const char* DEFAULT_SHORT = "%a %d %b %Y %H:%M:%S";
+
+ /** A long time format picked for being readable (e.g. "Sunday, 23 March 2025 @ 10:20:30 GMT"). */
+ inline constexpr const char* DEFAULT_LONG = "%A, %d %B %Y @ %H:%M:%S %Z";
+
+ /** The time format specified in ISO 8601 (e.g. "2025-03-23T10:20:30+0000") */
+ inline constexpr const char* ISO_8601 = "%Y-%m-%dT%H:%M:%S%z";
+
+ /** The time format specified in RFC 1123 (e.g. "Sun, 23 Mar 2025 10:20:30 GMT") */
+ inline constexpr const char* RFC_1123 = "%a, %d %b %Y %H:%M:%S %Z";
+
/** Converts a UNIX timestamp to a time string.
*
* @param ts The timestamp to convert to a string.