~ubuntu-branches/ubuntu/oneiric/libclaw/oneiric

« back to all changes in this revision

Viewing changes to claw/code/log_level.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Julien Jorge
  • Date: 2010-12-23 20:55:14 UTC
  • mfrom: (4.2.1 sid)
  • Revision ID: james.westby@ubuntu.com-20101223205514-s10m6ywla7s4ttqf
Tags: 1.6.1-3
UploadĀ inĀ sid

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
  CLAW is a free library without any particular aim but being useful to 
5
5
  anyone.
6
6
 
7
 
  Copyright (C) 2005-2008 Julien Jorge
 
7
  Copyright (C) 2005-2010 Julien Jorge
8
8
 
9
9
  This library is free software; you can redistribute it and/or
10
10
  modify it under the terms of the GNU Lesser General Public
29
29
 */
30
30
#include <claw/log_level.hpp>
31
31
 
 
32
#include <claw/claw_gettext.hpp>
 
33
 
32
34
namespace claw
33
35
{
34
 
  log_level log_error( 0, "error" );
35
 
  log_level log_warning( 1, "warning" );
 
36
  log_level log_error( 0, "error: " );
 
37
  log_level log_warning( 1, "warning: " );
36
38
  log_level log_verbose( 15 );
37
39
} // namespace claw
38
40
 
54
56
 * \param s The messages prefix.
55
57
 */
56
58
claw::log_level::log_level( int lvl, const std::string& s )
57
 
  : m_level(lvl), m_prefix(s + ": ")
 
59
  : m_level(lvl), m_prefix(s)
58
60
{
59
61
 
60
62
} // log_level::log_level()
72
74
/**
73
75
 * \brief Get the prefix.
74
76
 */
75
 
const std::string& claw::log_level::get_string() const
 
77
std::string claw::log_level::get_string() const
76
78
{
77
 
  return m_prefix;
 
79
  if (m_prefix.empty())
 
80
    return m_prefix;
 
81
  else
 
82
    return claw_gettext(m_prefix.c_str());
78
83
} // log_level::get_string()