Skip to content

Commit e3674ce

Browse files
committed
Merge pull request #124 from Backendless/T-9293
T 9293
2 parents aab41d4 + 298429e commit e3674ce

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/com/backendless/exceptions/ExceptionMessage.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,5 @@ public class ExceptionMessage
139139
public final static String NOT_FOUND_PROVIDER = "The provider for tracking location cannot be found. Please check if the permission android.permission.ACCESS_FINE_LOCATION has been added to the application manifest.";
140140

141141
public final static String INVALID_LOG_POLICY = "Either the number of messages or the time frequency must be a positive value";
142+
public final static String INVALID_LOG_NAME = "Log name cannot be empty";
142143
}

src/com/backendless/logging/Logger.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
package com.backendless.logging;
2020

21+
import com.backendless.exceptions.ExceptionMessage;
22+
2123
/**
2224
* Created by baas on 21.04.15.
2325
*/
@@ -33,6 +35,9 @@ public static Logger getLogger( Class clazz )
3335

3436
public static Logger getLogger( String name )
3537
{
38+
if( name == null || name.trim().isEmpty() )
39+
throw new IllegalArgumentException( ExceptionMessage.INVALID_LOG_NAME );
40+
3641
return new Logger( name );
3742
}
3843

@@ -71,7 +76,8 @@ public void error( String message, Throwable t )
7176
logBufer.enqueue( name, Level.ERROR, message, t );
7277
}
7378

74-
public void fatal( String message ){
79+
public void fatal( String message )
80+
{
7581
logBufer.enqueue( name, Level.FATAL, message, null );
7682
}
7783

@@ -80,7 +86,8 @@ public void fatal( String message, Throwable t )
8086
logBufer.enqueue( name, Level.FATAL, message, t );
8187
}
8288

83-
public void trace( String message ){
89+
public void trace( String message )
90+
{
8491
logBufer.enqueue( name, Level.TRACE, message, null );
8592
}
8693
}

0 commit comments

Comments
 (0)