Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
Vivy
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Wiki externe
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Elliu
Vivy
Validations
21457a79
Vérifiée
Valider
21457a79
rédigé
3 years ago
par
Kubat
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
LOG: Get a logger from the sink if it was already created
parent
bd43295f
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion
!21
Add clean logs support + dependent MR
Modifications
2
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
src/Lib/Log.cc
+17
-0
17 ajouts, 0 suppression
src/Lib/Log.cc
src/Lib/Log.hh
+4
-3
4 ajouts, 3 suppressions
src/Lib/Log.hh
avec
21 ajouts
et
3 suppressions
src/Lib/Log.cc
+
17
−
0
Voir le fichier @
21457a79
...
@@ -69,6 +69,23 @@ LogSink::closeLoggerClients() noexcept
...
@@ -69,6 +69,23 @@ LogSink::closeLoggerClients() noexcept
[](
const
std
::
weak_ptr
<
Logger
>
&
weakPtr
)
{
return
!
weakPtr
.
expired
();
}));
[](
const
std
::
weak_ptr
<
Logger
>
&
weakPtr
)
{
return
!
weakPtr
.
expired
();
}));
}
}
std
::
shared_ptr
<
Logger
>
LogSink
::
getLoggerClient
(
const
std
::
string_view
category
)
const
{
auto
end
=
std
::
end
(
clientLoggers
);
auto
it
=
std
::
find_if
(
std
::
begin
(
clientLoggers
),
end
,
[
category
](
const
std
::
weak_ptr
<
Logger
>
&
weakPtr
)
{
std
::
shared_ptr
<
Logger
>
sharedPtr
=
weakPtr
.
lock
();
return
sharedPtr
&&
(
sharedPtr
->
getCategoryView
()
==
category
);
});
if
(
it
==
end
)
throw
std
::
logic_error
(
"Logger was not found"
);
std
::
shared_ptr
<
Logger
>
sharedPtr
=
(
*
it
).
lock
();
if
(
sharedPtr
==
nullptr
)
throw
std
::
logic_error
(
"Logger has expired"
);
return
sharedPtr
;
}
LogMessage
LogMessage
Logger
::
logEvent
(
const
char
*
fileName
,
const
char
*
functionName
,
const
int
lineNumber
,
Logger
::
logEvent
(
const
char
*
fileName
,
const
char
*
functionName
,
const
int
lineNumber
,
const
LogLevel
logSeverity
)
noexcept
const
LogLevel
logSeverity
)
noexcept
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
src/Lib/Log.hh
+
4
−
3
Voir le fichier @
21457a79
...
@@ -53,10 +53,11 @@ public:
...
@@ -53,10 +53,11 @@ public:
static
std
::
shared_ptr
<
LogSink
>
newSink
()
noexcept
;
static
std
::
shared_ptr
<
LogSink
>
newSink
()
noexcept
;
~
LogSink
()
noexcept
;
~
LogSink
()
noexcept
;
void
recieveLogMessage
(
const
Logger
*
const
,
LogMessage
const
&
)
noexcept
;
void
registerLoggerClient
(
std
::
shared_ptr
<
Logger
>
)
noexcept
;
void
registerLoggerClient
(
std
::
shared_ptr
<
Logger
>
)
noexcept
;
void
closeLoggerClients
()
noexcept
;
void
closeLoggerClients
()
noexcept
;
std
::
shared_ptr
<
Logger
>
getLoggerClient
(
const
std
::
string_view
category
)
const
;
void
recieveLogMessage
(
const
Logger
*
const
,
LogMessage
const
&
)
noexcept
;
private:
private:
std
::
mutex
messageQueueLock
{};
std
::
mutex
messageQueueLock
{};
...
@@ -126,7 +127,7 @@ class Logger : public std::enable_shared_from_this<Logger> {
...
@@ -126,7 +127,7 @@ class Logger : public std::enable_shared_from_this<Logger> {
public
:
public
:
// Templated constructor, construct from anything that can be considered as
// Templated constructor, construct from anything that can be considered as
// a string.
// a string.
explicit
Logger
(
LogSink
*
const
sink
,
const
std
::
string_view
category
)
noexcept
explicit
Logger
(
LogSink
*
const
sink
,
const
StringType
auto
category
)
noexcept
:
parentLogSink
(
sink
)
:
parentLogSink
(
sink
)
,
logCategory
(
anyStringToStdString
(
category
))
,
logCategory
(
anyStringToStdString
(
category
))
{
{
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter