summaryrefslogtreecommitdiff
path: root/libfrontend-elements/frontend-elements/diagnostic.cxx
blob: c99061f13914dd3398d8e8613104d2398366c87c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// file      : frontend-elements/diagnostic.cxx
// author    : Boris Kolpackov <boris@kolpackov.net>
// copyright : Copyright (c) 2005-2010 Boris Kolpackov
// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file

#include <frontend-elements/diagnostic.hxx>

#include <iostream>

namespace FrontendElements
{
  namespace Diagnostic
  {
    using std::cerr;
    using std::endl;

    Log& Log::
    operator<< (Record const& r)
    {
      cerr << r.file () << ":" << r.line ();

      if (r.char_p ()) cerr << ":" << r.char_ ();

      cerr << ": ";

      r.kind ().print (cerr);

      cerr << ": " << r.text () << endl;

      return *this;
    }

    Log& Log::
    instance ()
    {
      static Log l;
      return l;
    }
  }
}